diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/alloc.c b/src/alloc.c index c7419e2fa5f..7bed3f4488d 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -224,7 +224,7 @@ struct emacs_globals globals; | |||
| 224 | 224 | ||
| 225 | /* maybe_gc collects garbage if this goes negative. */ | 225 | /* maybe_gc collects garbage if this goes negative. */ |
| 226 | 226 | ||
| 227 | object_ct consing_until_gc; | 227 | consing_ct consing_until_gc; |
| 228 | 228 | ||
| 229 | #ifdef HAVE_PDUMPER | 229 | #ifdef HAVE_PDUMPER |
| 230 | /* Number of finalizers run: used to loop over GC until we stop | 230 | /* Number of finalizers run: used to loop over GC until we stop |
| @@ -236,9 +236,10 @@ int number_finalizers_run; | |||
| 236 | 236 | ||
| 237 | bool gc_in_progress; | 237 | bool gc_in_progress; |
| 238 | 238 | ||
| 239 | /* System byte counts reported by GC. */ | 239 | /* System byte and object counts reported by GC. */ |
| 240 | 240 | ||
| 241 | typedef uintptr_t byte_ct; | 241 | typedef uintptr_t byte_ct; |
| 242 | typedef intptr_t object_ct; | ||
| 242 | 243 | ||
| 243 | /* Number of live and free conses etc. */ | 244 | /* Number of live and free conses etc. */ |
| 244 | 245 | ||
| @@ -2546,7 +2547,7 @@ free_cons (struct Lisp_Cons *ptr) | |||
| 2546 | might incorrectly return non-zero. */ | 2547 | might incorrectly return non-zero. */ |
| 2547 | int incr = sizeof *ptr; | 2548 | int incr = sizeof *ptr; |
| 2548 | if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc)) | 2549 | if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc)) |
| 2549 | consing_until_gc = OBJECT_CT_MAX; | 2550 | consing_until_gc = CONSING_CT_MAX; |
| 2550 | gcstat.total_free_conses++; | 2551 | gcstat.total_free_conses++; |
| 2551 | } | 2552 | } |
| 2552 | 2553 | ||
| @@ -5501,7 +5502,7 @@ staticpro (Lisp_Object const *varaddress) | |||
| 5501 | static void | 5502 | static void |
| 5502 | allow_garbage_collection (intmax_t consing) | 5503 | allow_garbage_collection (intmax_t consing) |
| 5503 | { | 5504 | { |
| 5504 | consing_until_gc = consing - (OBJECT_CT_MAX - consing_until_gc); | 5505 | consing_until_gc = consing - (CONSING_CT_MAX - consing_until_gc); |
| 5505 | garbage_collection_inhibited--; | 5506 | garbage_collection_inhibited--; |
| 5506 | } | 5507 | } |
| 5507 | 5508 | ||
| @@ -5511,7 +5512,7 @@ inhibit_garbage_collection (void) | |||
| 5511 | ptrdiff_t count = SPECPDL_INDEX (); | 5512 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5512 | record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc); | 5513 | record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc); |
| 5513 | garbage_collection_inhibited++; | 5514 | garbage_collection_inhibited++; |
| 5514 | consing_until_gc = OBJECT_CT_MAX; | 5515 | consing_until_gc = CONSING_CT_MAX; |
| 5515 | return count; | 5516 | return count; |
| 5516 | } | 5517 | } |
| 5517 | 5518 | ||
| @@ -5817,7 +5818,7 @@ garbage_collect_1 (struct gcstat *gcst) | |||
| 5817 | 5818 | ||
| 5818 | /* In case user calls debug_print during GC, | 5819 | /* In case user calls debug_print during GC, |
| 5819 | don't let that cause a recursive GC. */ | 5820 | don't let that cause a recursive GC. */ |
| 5820 | consing_until_gc = OBJECT_CT_MAX; | 5821 | consing_until_gc = CONSING_CT_MAX; |
| 5821 | 5822 | ||
| 5822 | /* Save what's currently displayed in the echo area. Don't do that | 5823 | /* Save what's currently displayed in the echo area. Don't do that |
| 5823 | if we are GC'ing because we've run out of memory, since | 5824 | if we are GC'ing because we've run out of memory, since |
| @@ -5932,19 +5933,17 @@ garbage_collect_1 (struct gcstat *gcst) | |||
| 5932 | consing_until_gc = memory_full_cons_threshold; | 5933 | consing_until_gc = memory_full_cons_threshold; |
| 5933 | else | 5934 | else |
| 5934 | { | 5935 | { |
| 5935 | intptr_t threshold = min (max (GC_DEFAULT_THRESHOLD / 10, | 5936 | consing_ct threshold = max (gc_cons_threshold, GC_DEFAULT_THRESHOLD / 10); |
| 5936 | gc_cons_threshold), | ||
| 5937 | OBJECT_CT_MAX); | ||
| 5938 | if (FLOATP (Vgc_cons_percentage)) | 5937 | if (FLOATP (Vgc_cons_percentage)) |
| 5939 | { | 5938 | { |
| 5940 | double tot = (XFLOAT_DATA (Vgc_cons_percentage) | 5939 | double tot = (XFLOAT_DATA (Vgc_cons_percentage) |
| 5941 | * total_bytes_of_live_objects ()); | 5940 | * total_bytes_of_live_objects ()); |
| 5942 | if (threshold < tot) | 5941 | if (threshold < tot) |
| 5943 | { | 5942 | { |
| 5944 | if (tot < OBJECT_CT_MAX) | 5943 | if (tot < CONSING_CT_MAX) |
| 5945 | threshold = tot; | 5944 | threshold = tot; |
| 5946 | else | 5945 | else |
| 5947 | threshold = OBJECT_CT_MAX; | 5946 | threshold = CONSING_CT_MAX; |
| 5948 | } | 5947 | } |
| 5949 | } | 5948 | } |
| 5950 | consing_until_gc = threshold; | 5949 | consing_until_gc = threshold; |