[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8800: Compilation error caused by SPARE_MEMORY

From: Paul Eggert
Subject: bug#8800: Compilation error caused by SPARE_MEMORY
Date: Mon, 06 Jun 2011 09:42:29 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

On 06/06/11 05:02, Donald Ephraim Curtis wrote:
> shouldn't there still be a check to see if SPARE_MEMORY is defined already?

If SYSTEM_MALLOC is not defined, SPARE_MEMORY must be defined,
so the code is OK.  This can be seen by looking at the larger context
in alloc.c.  However, I can see that the code is confusing, so
I simplified it this way:

* alloc.c: Simplify handling of large-request failures (Bug#8800).
(SPARE_MEMORY): Always define.
(memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
=== modified file 'src/alloc.c'
--- src/alloc.c 2011-06-06 04:54:23 +0000
+++ src/alloc.c 2011-06-06 16:39:06 +0000
@@ -190,17 +190,10 @@

 static char *spare_memory[7];

-/* Amount of spare memory to keep in large reserve block.  */
+/* Amount of spare memory to keep in large reserve block, or to see
+   whether this much is available when malloc fails on a larger request.  */

 #define SPARE_MEMORY (1 << 14)
-# define LARGE_REQUEST (1 << 14)

 /* Number of extra blocks malloc should get when it needs more core.  */

@@ -3289,9 +3282,9 @@
   /* Do not go into hysterics merely because a large request failed.  */
   int enough_free_memory = 0;
-  if (LARGE_REQUEST < nbytes)
+  if (SPARE_MEMORY < nbytes)
-      void *p = malloc (LARGE_REQUEST);
+      void *p = malloc (SPARE_MEMORY);
       if (p)
          free (p);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]