diff options
| author | Karl Heuer | 1994-02-28 20:20:22 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-02-28 20:20:22 +0000 |
| commit | bcb61d60fce18f87184d3098103d82bd118d859d (patch) | |
| tree | 1175441f3801e6352d982a7ede7052afd53c669c /src/alloc.c | |
| parent | 0f7159e3b0331a7758bb56a5cb0e187b5764b208 (diff) | |
| download | emacs-bcb61d60fce18f87184d3098103d82bd118d859d.tar.gz emacs-bcb61d60fce18f87184d3098103d82bd118d859d.zip | |
(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.c | 13 |
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; | |||
| 98 | /* If nonzero, this is a warning delivered by malloc and not yet displayed. */ | 98 | /* If nonzero, this is a warning delivered by malloc and not yet displayed. */ |
| 99 | char *pending_malloc_warning; | 99 | char *pending_malloc_warning; |
| 100 | 100 | ||
| 101 | /* Pre-computed signal argument for use when memory is exhausted. */ | ||
| 102 | static Lisp_Object memory_signal_data; | ||
| 103 | |||
| 101 | /* Maximum amount of C stack to save when a GC happens. */ | 104 | /* Maximum amount of C stack to save when a GC happens. */ |
| 102 | 105 | ||
| 103 | #ifndef MAX_SAVE_STACK | 106 | #ifndef MAX_SAVE_STACK |
| @@ -148,7 +151,10 @@ display_malloc_warning () | |||
| 148 | /* Called if malloc returns zero */ | 151 | /* Called if malloc returns zero */ |
| 149 | memory_full () | 152 | memory_full () |
| 150 | { | 153 | { |
| 151 | error ("Memory exhausted"); | 154 | /* This used to call error, but if we've run out of memory, we could get |
| 155 | infinite recursion trying to build the string. */ | ||
| 156 | while (1) | ||
| 157 | Fsignal (Qerror, memory_signal_data); | ||
| 152 | } | 158 | } |
| 153 | 159 | ||
| 154 | /* like malloc routines but check for no memory and block interrupt input. */ | 160 | /* 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\ | |||
| 2216 | which includes both saved text and other data."); | 2222 | which includes both saved text and other data."); |
| 2217 | undo_strong_limit = 30000; | 2223 | undo_strong_limit = 30000; |
| 2218 | 2224 | ||
| 2225 | /* We build this in advance because if we wait until we need it, we might | ||
| 2226 | not be able to allocate the memory to hold it. */ | ||
| 2227 | memory_signal_data = Fcons (build_string ("Memory exhausted"), Qnil); | ||
| 2228 | staticpro (&memory_signal_data); | ||
| 2229 | |||
| 2219 | defsubr (&Scons); | 2230 | defsubr (&Scons); |
| 2220 | defsubr (&Slist); | 2231 | defsubr (&Slist); |
| 2221 | defsubr (&Svector); | 2232 | defsubr (&Svector); |