From 951eb3d445103345404115dca5e5b3d6eed30bc4 Mon Sep 17 00:00:00 2001 From: d-netto Date: Wed, 12 Nov 2025 19:23:38 -0500 Subject: [PATCH] remove last_live_bytes global variable to simplify GC metrics code a bit --- src/gc-stock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gc-stock.c b/src/gc-stock.c index 704ca0e28bee7..f7470e83db36c 100644 --- a/src/gc-stock.c +++ b/src/gc-stock.c @@ -205,7 +205,6 @@ int under_pressure = 0; // Full collection heuristics static int64_t live_bytes = 0; static int64_t promoted_bytes = 0; -static int64_t last_live_bytes = 0; // live_bytes at last collection #ifdef __GLIBC__ // maxrss at last malloc_trim static int64_t last_trim_maxrss = 0; @@ -3362,7 +3361,7 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection) JL_NOTS #endif _report_gc_finished(pause, gc_num.freed, sweep_full, recollect, live_bytes); - uint64_t max_memory = last_live_bytes + gc_num.allocd; + uint64_t max_memory = live_bytes + gc_num.allocd; if (max_memory > gc_num.max_memory) { gc_num.max_memory = max_memory; } @@ -3370,7 +3369,6 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection) JL_NOTS gc_time_sweep_pause(gc_end_time, gc_num.allocd, live_bytes, gc_num.freed, sweep_full); gc_num.full_sweep += sweep_full; - last_live_bytes = live_bytes; live_bytes += -gc_num.freed + gc_num.allocd; jl_timing_counter_dec(JL_TIMING_COUNTER_HeapSize, gc_num.freed);