From 540474edecca07e28d1031dde06b47c24ae46025 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 14 Sep 2022 07:59:12 +0300 Subject: Count bytes allocated past latest GC when printing statistic on heap growth (fix of commit dbf1d2e9b) * alloc.c (GC_compute_heap_usage_percent): Add GC_bytes_allocd value to "used" local variable. * alloc.c (GC_DBGLOG_PRINT_HEAP_IN_USE): Add GC_bytes_allocd value when printing GC_atomic_in_use one. --- alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'alloc.c') diff --git a/alloc.c b/alloc.c index f9135d42..fdb32dd6 100644 --- a/alloc.c +++ b/alloc.c @@ -1078,7 +1078,7 @@ GC_on_heap_resize_proc GC_on_heap_resize = 0; /* Used for logging only. */ GC_INLINE int GC_compute_heap_usage_percent(void) { - word used = GC_composite_in_use + GC_atomic_in_use; + word used = GC_composite_in_use + GC_atomic_in_use + GC_bytes_allocd; word heap_sz = GC_heapsize - GC_unmapped_bytes; # if defined(CPPCHECK) word limit = (GC_WORD_MAX >> 1) / 50; /* to avoid a false positive */ @@ -1094,7 +1094,7 @@ GC_INLINE int GC_compute_heap_usage_percent(void) GC_DBGLOG_PRINTF("In-use heap: %d%% (%lu KiB pointers + %lu KiB other)\n", \ GC_compute_heap_usage_percent(), \ TO_KiB_UL(GC_composite_in_use), \ - TO_KiB_UL(GC_atomic_in_use)) + TO_KiB_UL(GC_atomic_in_use + GC_bytes_allocd)) /* Finish up a collection. Assumes mark bits are consistent, but the */ /* world is otherwise running. */ -- cgit v1.2.1