aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-11 20:19:46 +0000
committerRichard M. Stallman1995-04-11 20:19:46 +0000
commite81976428cc657a9c7370a14d7ad817257642eff (patch)
tree8e4d925b91545d9fd342af9b3f00ce89d55f078c /src/alloc.c
parenta9cb9b801056e4bcefa95724b07c3fb34d24a6f6 (diff)
downloademacs-e81976428cc657a9c7370a14d7ad817257642eff.tar.gz
emacs-e81976428cc657a9c7370a14d7ad817257642eff.zip
(inhibit_garbage_collection): New function.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 2436a112ea6..32c5a569fcb 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -155,6 +155,8 @@ int stack_copy_size;
155/* Non-zero means ignore malloc warnings. Set during initialization. */ 155/* Non-zero means ignore malloc warnings. Set during initialization. */
156int ignore_warnings; 156int ignore_warnings;
157 157
158Lisp_Object Qgc_cons_threshold;
159
158static void mark_object (), mark_buffer (), mark_kboards (); 160static void mark_object (), mark_buffer (), mark_kboards ();
159static void clear_marks (), gc_sweep (); 161static void clear_marks (), gc_sweep ();
160static void compact_strings (); 162static void compact_strings ();
@@ -1316,6 +1318,18 @@ int total_free_conses, total_free_markers, total_free_symbols;
1316int total_free_floats, total_floats; 1318int total_free_floats, total_floats;
1317#endif /* LISP_FLOAT_TYPE */ 1319#endif /* LISP_FLOAT_TYPE */
1318 1320
1321/* Temporarily prevent garbage collection. */
1322
1323int
1324inhibit_garbage_collection ()
1325{
1326 int count = specpdl_ptr - specpdl;
1327
1328 specbind (Qgc_cons_threshold, make_number ((1 << (VALBITS - 1)) - 1));
1329
1330 return count;
1331}
1332
1319DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 1333DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
1320 "Reclaim storage for Lisp objects no longer needed.\n\ 1334 "Reclaim storage for Lisp objects no longer needed.\n\
1321Returns info on amount of space in use:\n\ 1335Returns info on amount of space in use:\n\
@@ -2419,6 +2433,9 @@ which includes both saved text and other data.");
2419 = Fcons (Qerror, Fcons (build_string ("Memory exhausted--use M-x save-some-buffers RET"), Qnil)); 2433 = Fcons (Qerror, Fcons (build_string ("Memory exhausted--use M-x save-some-buffers RET"), Qnil));
2420 staticpro (&memory_signal_data); 2434 staticpro (&memory_signal_data);
2421 2435
2436 staticpro (&Qgc_cons_threshold);
2437 Qgc_cons_threshold = intern ("gc-cons-threshold");
2438
2422 defsubr (&Scons); 2439 defsubr (&Scons);
2423 defsubr (&Slist); 2440 defsubr (&Slist);
2424 defsubr (&Svector); 2441 defsubr (&Svector);