summaryrefslogtreecommitdiffstats
path: root/lib/memory.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-12-02 16:20:00 +0100
committerDavid Lamparter <equinox@diac24.net>2020-04-01 06:53:26 +0200
commit767439c55858d65bf6f5776b7fcd36cc1132565c (patch)
treed6eb0daa9975f6ff20eca5b69955af23a7db97ad /lib/memory.c
parentlib: rewrite zlog lock-free & TLS-buffered (diff)
downloadfrr-767439c55858d65bf6f5776b7fcd36cc1132565c.tar.xz
frr-767439c55858d65bf6f5776b7fcd36cc1132565c.zip
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 <equinox@diac24.net>
Diffstat (limited to 'lib/memory.c')
-rw-r--r--lib/memory.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/memory.c b/lib/memory.c
index 149e294d5..3a2940482 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,