diff options
| author | Paul Eggert | 2011-06-05 21:54:23 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-05 21:54:23 -0700 |
| commit | 4d09bcf621ec32e17fdb8dd2ea08344486f7aeef (patch) | |
| tree | 69688fb31481f4973c31d6a11284e0afbb9d3104 | |
| parent | e71564921ec760638105c910fdfae8b648724130 (diff) | |
| download | emacs-4d09bcf621ec32e17fdb8dd2ea08344486f7aeef.tar.gz emacs-4d09bcf621ec32e17fdb8dd2ea08344486f7aeef.zip | |
* alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO).
Fixes: debbugs:8800
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/alloc.c | 15 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ca369bf38f6..230e282e210 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-06-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800). | ||
| 4 | Do not assume that spare memory exists; that assumption is valid | ||
| 5 | only if SYSTEM_MALLOC. | ||
| 6 | (LARGE_REQUEST): New macro, so that the issue of large requests | ||
| 7 | is separated from the issue of spare memory. | ||
| 8 | |||
| 1 | 2011-06-05 Andreas Schwab <schwab@linux-m68k.org> | 9 | 2011-06-05 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 10 | ||
| 3 | * editfns.c (Fformat): Correctly handle zero flag with hexadecimal | 11 | * 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]; | |||
| 196 | #define SPARE_MEMORY (1 << 14) | 196 | #define SPARE_MEMORY (1 << 14) |
| 197 | #endif | 197 | #endif |
| 198 | 198 | ||
| 199 | #ifdef SYSTEM_MALLOC | ||
| 200 | # define LARGE_REQUEST (1 << 14) | ||
| 201 | #else | ||
| 202 | # define LARGE_REQUEST SPARE_MEMORY | ||
| 203 | #endif | ||
| 204 | |||
| 199 | /* Number of extra blocks malloc should get when it needs more core. */ | 205 | /* Number of extra blocks malloc should get when it needs more core. */ |
| 200 | 206 | ||
| 201 | static int malloc_hysteresis; | 207 | static int malloc_hysteresis; |
| @@ -3283,15 +3289,12 @@ memory_full (size_t nbytes) | |||
| 3283 | { | 3289 | { |
| 3284 | /* Do not go into hysterics merely because a large request failed. */ | 3290 | /* Do not go into hysterics merely because a large request failed. */ |
| 3285 | int enough_free_memory = 0; | 3291 | int enough_free_memory = 0; |
| 3286 | if (SPARE_MEMORY < nbytes) | 3292 | if (LARGE_REQUEST < nbytes) |
| 3287 | { | 3293 | { |
| 3288 | void *p = malloc (SPARE_MEMORY); | 3294 | void *p = malloc (LARGE_REQUEST); |
| 3289 | if (p) | 3295 | if (p) |
| 3290 | { | 3296 | { |
| 3291 | if (spare_memory[0]) | 3297 | free (p); |
| 3292 | free (p); | ||
| 3293 | else | ||
| 3294 | spare_memory[0] = p; | ||
| 3295 | enough_free_memory = 1; | 3298 | enough_free_memory = 1; |
| 3296 | } | 3299 | } |
| 3297 | } | 3300 | } |