From c42a2b8c945d1b45672a2b1715dfa586daaec657 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 21 Nov 2024 15:26:23 +0100 Subject: [PATCH] BUG/MINOR: activity/memprofile: reinitialize the free calls on DSO summary In commit 401fb0e87a ("MINOR: activity/memprofile: show per-DSO stats") we added a summary per DSO. However the free calls/tot were not initialized when creating a new entry because initially they were applied to any entry, but since we don't update free calls for non-free capable callers, we still need to reinitialize these entries when reassigning one. Because of this bug, a "show profiling memory" output can randomly show highly negative values on the DSO lines if it turns out that the DSO entry was created on an alloc instead of a realloc/free. Since the commit above was backported to 2.9, this one must go there as well. --- src/activity.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/activity.c b/src/activity.c index 1c43b2455..d65508856 100644 --- a/src/activity.c +++ b/src/activity.c @@ -900,6 +900,9 @@ static int cli_io_handler_show_profiling(struct appctx *appctx) (entry->method != MEMPROF_METH_CALLOC)) { tmp_memstats[j].free_calls = entry->free_calls; tmp_memstats[j].free_tot = entry->free_tot; + } else { + tmp_memstats[j].free_calls = 0; + tmp_memstats[j].free_tot = 0; } } else { tmp_memstats[j].alloc_calls += entry->alloc_calls;