From 2b6148e42e0d0c246575212e264104d17a746d0b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 6 Jun 2011 09:41:21 -0700 Subject: [PATCH] * 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. --- src/ChangeLog | 7 +++++++ src/alloc.c | 15 ++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 37fd595e270..e0a7645cf73 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-06-06 Paul Eggert + + * 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. + 2011-06-06 Martin Rudalics * lisp.h: Move EXFUNS for Fframe_root_window, 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; static char *spare_memory[7]; -#ifndef SYSTEM_MALLOC -/* 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) -#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. */ @@ -3289,9 +3282,9 @@ memory_full (size_t nbytes) { /* 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); -- 2.39.2