summaryrefslogtreecommitdiff
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-02-28 20:20:22 +0000
committerKarl Heuer <kwzh@gnu.org>1994-02-28 20:20:22 +0000
commitc8017724652c35d406ff21e3c85303c47cf63198 (patch)
tree3fa89daab5fe365b4aa20f7e13ee5db942e5d43f /src/alloc.c
parent1542d2c75828610ad58f94f7523dfc9b19fc5c05 (diff)
downloademacs-c8017724652c35d406ff21e3c85303c47cf63198.tar.gz
(memory_full): Use new variable memory_signal_data with precomputed value
instead of trying to build it after memory is already exhausted.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c
index f7544ab0b7c..f19ca3fb24c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -98,6 +98,9 @@ int pureptr;
/* If nonzero, this is a warning delivered by malloc and not yet displayed. */
char *pending_malloc_warning;
+/* Pre-computed signal argument for use when memory is exhausted. */
+static Lisp_Object memory_signal_data;
+
/* Maximum amount of C stack to save when a GC happens. */
#ifndef MAX_SAVE_STACK
@@ -148,7 +151,10 @@ display_malloc_warning ()
/* Called if malloc returns zero */
memory_full ()
{
- error ("Memory exhausted");
+ /* This used to call error, but if we've run out of memory, we could get
+ infinite recursion trying to build the string. */
+ while (1)
+ Fsignal (Qerror, memory_signal_data);
}
/* like malloc routines but check for no memory and block interrupt input. */
@@ -2216,6 +2222,11 @@ The size is counted as the number of bytes occupied,\n\
which includes both saved text and other data.");
undo_strong_limit = 30000;
+ /* We build this in advance because if we wait until we need it, we might
+ not be able to allocate the memory to hold it. */
+ memory_signal_data = Fcons (build_string ("Memory exhausted"), Qnil);
+ staticpro (&memory_signal_data);
+
defsubr (&Scons);
defsubr (&Slist);
defsubr (&Svector);