Mercurial > emacs
comparison src/alloc.c @ 6116:64417bbbb128
(memory_full): Use new variable memory_signal_data with precomputed value
instead of trying to build it after memory is already exhausted.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Mon, 28 Feb 1994 20:20:22 +0000 |
| parents | fbda87c8ad54 |
| children | 752d4237f869 |
comparison
equal
deleted
inserted
replaced
| 6115:e3d6c30a3906 | 6116:64417bbbb128 |
|---|---|
| 96 int pureptr; | 96 int pureptr; |
| 97 | 97 |
| 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 |
| 104 #define MAX_SAVE_STACK 16000 | 107 #define MAX_SAVE_STACK 16000 |
| 105 #endif | 108 #endif |
| 146 } | 149 } |
| 147 | 150 |
| 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. */ |
| 155 | 161 |
| 156 long * | 162 long * |
| 2214 This limit is applied when garbage collection happens.\n\ | 2220 This limit is applied when garbage collection happens.\n\ |
| 2215 The size is counted as the number of bytes occupied,\n\ | 2221 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); |
| 2222 defsubr (&Smake_byte_code); | 2233 defsubr (&Smake_byte_code); |
| 2223 defsubr (&Smake_list); | 2234 defsubr (&Smake_list); |
