From 1a98db2cdcabe86cb58318a96f13179fac36a1e3 Mon Sep 17 00:00:00 2001 From: Diogo Netto <61364108+d-netto@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:01:59 -0300 Subject: [PATCH] bugfix: don't set pool_live_bytes to zero at the end of GC (#107) --- src/gc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index 0e00ae0c45ed8..27eda9c45a26c 100644 --- a/src/gc.c +++ b/src/gc.c @@ -1167,8 +1167,14 @@ static void reset_thread_gc_counts(void) JL_NOTSAFEPOINT for (int i = 0; i < gc_n_threads; i++) { jl_ptls_t ptls = gc_all_tls_states[i]; if (ptls != NULL) { - memset(&ptls->gc_num, 0, sizeof(ptls->gc_num)); + // don't reset `pool_live_bytes` here jl_atomic_store_relaxed(&ptls->gc_num.allocd, -(int64_t)gc_num.interval); + jl_atomic_store_relaxed(&ptls->gc_num.freed, 0); + jl_atomic_store_relaxed(&ptls->gc_num.malloc, 0); + jl_atomic_store_relaxed(&ptls->gc_num.realloc, 0); + jl_atomic_store_relaxed(&ptls->gc_num.poolalloc, 0); + jl_atomic_store_relaxed(&ptls->gc_num.bigalloc, 0); + jl_atomic_store_relaxed(&ptls->gc_num.freecall, 0); } } }