From 767439c55858d65bf6f5776b7fcd36cc1132565c Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 2 Dec 2019 16:20:00 +0100 Subject: lib: mark some allocations as "active at exit" In some cases we really don't want to clean up things even when exiting (i.e. to keep the logging subsystem going.) This adds a flag on MGROUPs to indicate that. [v2: add "(active at exit)" marker text to debug memstats-at-exit] Signed-off-by: David Lamparter --- lib/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/memory.c') diff --git a/lib/memory.c b/lib/memory.c index 149e294d50..3a29404827 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -163,7 +163,8 @@ static int qmem_exit_walker(void *arg, struct memgroup *mg, struct memtype *mt) } else if (mt->n_alloc) { char size[32]; - eda->error++; + if (!mg->active_at_exit) + eda->error++; snprintf(size, sizeof(size), "%10zu", mt->size); fprintf(eda->fp, "%s: memstats: %-30s: %6zu * %s\n", eda->prefix, mt->name, mt->n_alloc, -- cgit v1.2.3