From 4bd63aa8202f0f794c91168f81c54938f67d1d80 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 28 Apr 2022 09:49:36 +0300 Subject: Remove USED_HEAP_SIZE macro (refactoring) * allchblk.c (GC_allochblk): Replace USED_HEAP_SIZE to GC_heapsize-GC_large_free_bytes. * alloc.c (GC_finish_collection): Likewise. * alloc.c (GC_finish_collection): Avoid potential underflow when subtracting GC_used_heap_size_after_full from USED_HEAP_SIZE. * include/private/gc_priv.h (USED_HEAP_SIZE): Remove macro. --- alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'alloc.c') diff --git a/alloc.c b/alloc.c index 503d9e8b..83a12e7d 100644 --- a/alloc.c +++ b/alloc.c @@ -1219,11 +1219,11 @@ STATIC void GC_finish_collection(void) + sizeof(GC_arrays))); GC_DBGLOG_PRINT_HEAP_IN_USE(); if (GC_is_full_gc) { - GC_used_heap_size_after_full = USED_HEAP_SIZE; + GC_used_heap_size_after_full = GC_heapsize - GC_large_free_bytes; GC_need_full_gc = FALSE; } else { - GC_need_full_gc = USED_HEAP_SIZE - GC_used_heap_size_after_full - > min_bytes_allocd(); + GC_need_full_gc = GC_heapsize - GC_used_heap_size_after_full + > min_bytes_allocd() + GC_large_free_bytes; } /* Reset or increment counters for next cycle */ -- cgit v1.2.1