comparison src/alloc.c @ 11374:1ebc81f84aa4

(inhibit_garbage_collection): New function.
author Richard M. Stallman <rms@gnu.org>
date Tue, 11 Apr 1995 20:19:46 +0000
parents e0f3fa4e7bf3
children bd3241a14d0a
comparison
equal deleted inserted replaced
11373:8381a25d021e 11374:1ebc81f84aa4
152 char *stack_copy; 152 char *stack_copy;
153 int stack_copy_size; 153 int stack_copy_size;
154 154
155 /* Non-zero means ignore malloc warnings. Set during initialization. */ 155 /* Non-zero means ignore malloc warnings. Set during initialization. */
156 int ignore_warnings; 156 int ignore_warnings;
157
158 Lisp_Object Qgc_cons_threshold;
157 159
158 static void mark_object (), mark_buffer (), mark_kboards (); 160 static void mark_object (), mark_buffer (), mark_kboards ();
159 static void clear_marks (), gc_sweep (); 161 static void clear_marks (), gc_sweep ();
160 static void compact_strings (); 162 static void compact_strings ();
161 163
1313 int total_conses, total_markers, total_symbols, total_string_size, total_vector_size; 1315 int total_conses, total_markers, total_symbols, total_string_size, total_vector_size;
1314 int total_free_conses, total_free_markers, total_free_symbols; 1316 int total_free_conses, total_free_markers, total_free_symbols;
1315 #ifdef LISP_FLOAT_TYPE 1317 #ifdef LISP_FLOAT_TYPE
1316 int total_free_floats, total_floats; 1318 int total_free_floats, total_floats;
1317 #endif /* LISP_FLOAT_TYPE */ 1319 #endif /* LISP_FLOAT_TYPE */
1320
1321 /* Temporarily prevent garbage collection. */
1322
1323 int
1324 inhibit_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 }
1318 1332
1319 DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 1333 DEFUN ("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\
1321 Returns info on amount of space in use:\n\ 1335 Returns info on amount of space in use:\n\
1322 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\ 1336 ((USED-CONSES . FREE-CONSES) (USED-SYMS . FREE-SYMS)\n\
2417 not be able to allocate the memory to hold it. */ 2431 not be able to allocate the memory to hold it. */
2418 memory_signal_data 2432 memory_signal_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);
2425 defsubr (&Smake_byte_code); 2442 defsubr (&Smake_byte_code);
2426 defsubr (&Smake_list); 2443 defsubr (&Smake_list);