From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: Possible memory corruption problem Date: Sun, 12 Feb 2006 23:40:51 -0500 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1139806046 22459 80.91.229.2 (13 Feb 2006 04:47:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2006 04:47:26 +0000 (UTC) Cc: piet@cs.uu.nl, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 13 05:47:25 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F8VcN-0001ON-2L for ged-emacs-devel@m.gmane.org; Mon, 13 Feb 2006 05:47:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8VcM-0003Uw-6d for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2006 23:47:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F8VW9-0007kQ-Gm for emacs-devel@gnu.org; Sun, 12 Feb 2006 23:40:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F8VW8-0007jz-R1 for emacs-devel@gnu.org; Sun, 12 Feb 2006 23:40:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8VW8-0007ju-Ko for emacs-devel@gnu.org; Sun, 12 Feb 2006 23:40:52 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F8VaV-0002Z4-Pe for emacs-devel@gnu.org; Sun, 12 Feb 2006 23:45:23 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1F8VW7-0007Ts-Pe; Sun, 12 Feb 2006 23:40:51 -0500 Original-To: Eli Zaretskii In-reply-to: (message from Eli Zaretskii on Mon, 06 Feb 2006 21:13:45 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:50448 Archived-At: I'd rather suspect something else: that some library function on your platform is passed a pointer to buffer text, and that library function calls malloc internally, which (especially when Emacs needs to allocate a large amount of memory) causes Emacs to relocate buffer text, which could easily invalidate the pointer(s) used by that library function. It is very rare in Emacs to pass a library function a pointer to buffer text. And in most cases these library functions are low-level, such as memcpy, read, or write. They should not call malloc. Is there any place where Emacs calls other C library functions on buffer text? > I have tried to find the common circumstances when this happens and it > aeems to me that it happens when the machine is low on virtual memory > (including swap space). Emacs should display a warning when the system is low on memory. Does it? Emacs tries to estimate how much memory is available, but that estimate may not really work. For instance, it never works for me. The code to estimate available space worked in the 80s on Unix, but it may need adaptation to the systems of today.