aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorRichard M. Stallman2002-07-11 17:44:22 +0000
committerRichard M. Stallman2002-07-11 17:44:22 +0000
commit74a54b047727b5209e93a99f80134643fc4636f6 (patch)
tree0a33e284885e2a6577cdbf32a23fa9530beeb840 /src/alloc.c
parent0cef4798af1315b47c113263996fb8cd41ca8b9d (diff)
downloademacs-74a54b047727b5209e93a99f80134643fc4636f6.tar.gz
emacs-74a54b047727b5209e93a99f80134643fc4636f6.zip
(Vmemory_full): New variable.
(Vmemory_signal_data): Renamed from memory_signal_data. Uses changed. (syms_of_alloc): Defvar them. (memory_full, buffer_memory_full): Set Vmemory_full.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 50de0a217c6..5bb636b549c 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -181,6 +181,10 @@ static int malloc_hysteresis;
181 181
182Lisp_Object Vpurify_flag; 182Lisp_Object Vpurify_flag;
183 183
184/* Non-nil means we are handling a memory-full error. */
185
186Lisp_Object Vmemory_full;
187
184#ifndef HAVE_SHM 188#ifndef HAVE_SHM
185 189
186/* Force it into data space! */ 190/* Force it into data space! */
@@ -224,7 +228,7 @@ char *pending_malloc_warning;
224 228
225/* Pre-computed signal argument for use when memory is exhausted. */ 229/* Pre-computed signal argument for use when memory is exhausted. */
226 230
227Lisp_Object memory_signal_data; 231Lisp_Object Vmemory_signal_data;
228 232
229/* Maximum amount of C stack to save when a GC happens. */ 233/* Maximum amount of C stack to save when a GC happens. */
230 234
@@ -469,6 +473,8 @@ display_malloc_warning ()
469void 473void
470memory_full () 474memory_full ()
471{ 475{
476 Vmemory_full = Qt;
477
472#ifndef SYSTEM_MALLOC 478#ifndef SYSTEM_MALLOC
473 bytes_used_when_full = BYTES_USED; 479 bytes_used_when_full = BYTES_USED;
474#endif 480#endif
@@ -483,7 +489,7 @@ memory_full ()
483 /* This used to call error, but if we've run out of memory, we could 489 /* This used to call error, but if we've run out of memory, we could
484 get infinite recursion trying to build the string. */ 490 get infinite recursion trying to build the string. */
485 while (1) 491 while (1)
486 Fsignal (Qnil, memory_signal_data); 492 Fsignal (Qnil, Vmemory_signal_data);
487} 493}
488 494
489 495
@@ -503,10 +509,12 @@ buffer_memory_full ()
503 memory_full (); 509 memory_full ();
504#endif 510#endif
505 511
512 Vmemory_full = Qt;
513
506 /* This used to call error, but if we've run out of memory, we could 514 /* This used to call error, but if we've run out of memory, we could
507 get infinite recursion trying to build the string. */ 515 get infinite recursion trying to build the string. */
508 while (1) 516 while (1)
509 Fsignal (Qerror, memory_signal_data); 517 Fsignal (Qnil, Vmemory_signal_data);
510} 518}
511 519
512 520
@@ -5541,11 +5549,17 @@ which includes both saved text and other data. */);
5541 Qpost_gc_hook = intern ("post-gc-hook"); 5549 Qpost_gc_hook = intern ("post-gc-hook");
5542 staticpro (&Qpost_gc_hook); 5550 staticpro (&Qpost_gc_hook);
5543 5551
5552 DEFVAR_LISP ("memory-signal-data", &Vmemory_signal_data,
5553 doc: /* Precomputed `signal' argument for memory-full error. */);
5544 /* We build this in advance because if we wait until we need it, we might 5554 /* We build this in advance because if we wait until we need it, we might
5545 not be able to allocate the memory to hold it. */ 5555 not be able to allocate the memory to hold it. */
5546 memory_signal_data 5556 Vmemory_signal_data
5547 = Fcons (Qerror, Fcons (build_string ("Memory exhausted--use M-x save-some-buffers RET"), Qnil)); 5557 = list2 (Qerror,
5548 staticpro (&memory_signal_data); 5558 build_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"));
5559
5560 DEFVAR_LISP ("memory-full", &Vmemory_full,
5561 doc: /* Non-nil means we are handling a memory-full error. */);
5562 Vmemory_full = Qnil;
5549 5563
5550 staticpro (&Qgc_cons_threshold); 5564 staticpro (&Qgc_cons_threshold);
5551 Qgc_cons_threshold = intern ("gc-cons-threshold"); 5565 Qgc_cons_threshold = intern ("gc-cons-threshold");