aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2011-06-06 09:41:21 -0700
committerPaul Eggert2011-06-06 09:41:21 -0700
commit2b6148e42e0d0c246575212e264104d17a746d0b (patch)
treea844668a141d6f4ffcf584444645ae95aa7b8eb8 /src/alloc.c
parent85cc1f119546380ffaa903de15a7fd6a51d1d198 (diff)
downloademacs-2b6148e42e0d0c246575212e264104d17a746d0b.tar.gz
emacs-2b6148e42e0d0c246575212e264104d17a746d0b.zip
* alloc.c: Simplify handling of large-request failures (Bug#8800).
(SPARE_MEMORY): Always define. (LARGE_REQUEST): Remove. (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 8d0fdd125dc..453286836fd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -190,17 +190,10 @@ static int total_free_floats, total_floats;
190 190
191static char *spare_memory[7]; 191static char *spare_memory[7];
192 192
193#ifndef SYSTEM_MALLOC 193/* Amount of spare memory to keep in large reserve block, or to see
194/* Amount of spare memory to keep in large reserve block. */ 194 whether this much is available when malloc fails on a larger request. */
195 195
196#define SPARE_MEMORY (1 << 14) 196#define SPARE_MEMORY (1 << 14)
197#endif
198
199#ifdef SYSTEM_MALLOC
200# define LARGE_REQUEST (1 << 14)
201#else
202# define LARGE_REQUEST SPARE_MEMORY
203#endif
204 197
205/* Number of extra blocks malloc should get when it needs more core. */ 198/* Number of extra blocks malloc should get when it needs more core. */
206 199
@@ -3289,9 +3282,9 @@ memory_full (size_t nbytes)
3289{ 3282{
3290 /* Do not go into hysterics merely because a large request failed. */ 3283 /* Do not go into hysterics merely because a large request failed. */
3291 int enough_free_memory = 0; 3284 int enough_free_memory = 0;
3292 if (LARGE_REQUEST < nbytes) 3285 if (SPARE_MEMORY < nbytes)
3293 { 3286 {
3294 void *p = malloc (LARGE_REQUEST); 3287 void *p = malloc (SPARE_MEMORY);
3295 if (p) 3288 if (p)
3296 { 3289 {
3297 free (p); 3290 free (p);