summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-09-14 07:59:12 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-09-14 07:59:12 +0300
commit540474edecca07e28d1031dde06b47c24ae46025 (patch)
tree373c1e9dc3743eb88d9e40a1cb23b7c93a8435d1 /alloc.c
parent69664ee76191c7b6a3745985b188652a3740aa2a (diff)
downloadbdwgc-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.c4
1 files changed, 2 insertions, 2 deletions
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. */