diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-09-14 07:59:12 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-09-14 07:59:12 +0300 |
commit | 540474edecca07e28d1031dde06b47c24ae46025 (patch) | |
tree | 373c1e9dc3743eb88d9e40a1cb23b7c93a8435d1 /alloc.c | |
parent | 69664ee76191c7b6a3745985b188652a3740aa2a (diff) | |
download | bdwgc-540474edecca07e28d1031dde06b47c24ae46025.tar.gz |
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.
Diffstat (limited to 'alloc.c')
-rw-r--r-- | alloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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. */ |