From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Compilation error caused by SPARE_MEMORY Date: Sun, 05 Jun 2011 21:59:20 -0700 Organization: UCLA Computer Science Department Message-ID: <4DEC5EA8.6000904@cs.ucla.edu> References: <9n62ok6j1i.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1307336406 16293 80.91.229.12 (6 Jun 2011 05:00:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Jun 2011 05:00:06 +0000 (UTC) Cc: 8800-done@debbugs.gnu.org, Emacs Development To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 06 07:00:00 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QTRuu-0000Xx-C8 for ged-emacs-devel@m.gmane.org; Mon, 06 Jun 2011 06:59:56 +0200 Original-Received: from localhost ([::1]:46904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTRut-0004KH-9c for ged-emacs-devel@m.gmane.org; Mon, 06 Jun 2011 00:59:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:53925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTRuf-0004K7-As for Emacs-devel@gnu.org; Mon, 06 Jun 2011 00:59:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTRud-000526-Uq for Emacs-devel@gnu.org; Mon, 06 Jun 2011 00:59:41 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:50566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTRud-000510-Hu; Mon, 06 Jun 2011 00:59:39 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 5F58939E8119; Sun, 5 Jun 2011 21:59:31 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NYABCY+ysPN7; Sun, 5 Jun 2011 21:59:30 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 365B839E80F7; Sun, 5 Jun 2011 21:59:30 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: <9n62ok6j1i.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:140219 Archived-At: On 06/05/11 14:54, Glenn Morris wrote: > As reported in http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8800 Thanks, that is a bug I recently introduced; it affects hosts such as MacOS that define SYSTEM_MALLOC. I fixed it in the trunk with bzr 104508, as follows: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-06-05 22:46:26 +0000 +++ src/ChangeLog 2011-06-06 04:54:23 +0000 @@ -1,3 +1,11 @@ +2011-06-06 Paul Eggert + + * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800). + Do not assume that spare memory exists; that assumption is valid + only if SYSTEM_MALLOC. + (LARGE_REQUEST): New macro, so that the issue of large requests + is separated from the issue of spare memory. + 2011-06-05 Andreas Schwab * editfns.c (Fformat): Correctly handle zero flag with hexadecimal === modified file 'src/alloc.c' --- src/alloc.c 2011-06-02 08:35:28 +0000 +++ src/alloc.c 2011-06-06 04:54:23 +0000 @@ -196,6 +196,12 @@ #define SPARE_MEMORY (1 << 14) #endif +#ifdef SYSTEM_MALLOC +# define LARGE_REQUEST (1 << 14) +#else +# define LARGE_REQUEST SPARE_MEMORY +#endif + /* Number of extra blocks malloc should get when it needs more core. */ static int malloc_hysteresis; @@ -3283,15 +3289,12 @@ { /* Do not go into hysterics merely because a large request failed. */ int enough_free_memory = 0; - if (SPARE_MEMORY < nbytes) + if (LARGE_REQUEST < nbytes) { - void *p = malloc (SPARE_MEMORY); + void *p = malloc (LARGE_REQUEST); if (p) { - if (spare_memory[0]) - free (p); - else - spare_memory[0] = p; + free (p); enough_free_memory = 1; } }