From: Paul Eggert Date: Mon, 6 Jun 2011 04:54:23 +0000 (-0700) Subject: * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO). X-Git-Tag: emacs-pretest-24.0.90~104^2~618^2~17 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4d09bcf621ec32e17fdb8dd2ea08344486f7aeef;p=emacs.git * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO). Fixes: debbugs:8800 --- diff --git a/src/ChangeLog b/src/ChangeLog index ca369bf38f6..230e282e210 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/alloc.c b/src/alloc.c index 0c18fca1755..8d0fdd125dc 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -196,6 +196,12 @@ static char *spare_memory[7]; #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 @@ memory_full (size_t nbytes) { /* 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; } }