mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
chg: dev: mem: checkfree assertion after debug list dump
When a memory context is destroyed, if the `checkfree` property is set, the program assert there is no remaining allocation. If there are and assertions are enabled, the program immediately stops. However, if memory trace/record debug is enabled, the dump of outstanding allocation won't be printed as it is done after the no remaining allocation assertion check. This moves the no remaining allocation assertion check after the dump of outstanding allocations, so it is still possible to figure out what's still allocated by this memory context. Merge branch 'colin/mem-checkfree-check-after-debuglist' into 'main' See merge request isc-projects/bind9!11110
This commit is contained in:
commit
54d7198a1a
1 changed files with 10 additions and 8 deletions
|
|
@ -547,20 +547,14 @@ mem_create(const char *name, isc_mem_t **ctxp, unsigned int debugging,
|
|||
|
||||
static void
|
||||
mem_destroy(isc_mem_t *ctx) {
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
|
||||
isc_refcount_destroy(&ctx->references);
|
||||
|
||||
LOCK(&contextslock);
|
||||
ISC_LIST_UNLINK(contexts, ctx, link);
|
||||
UNLOCK(&contextslock);
|
||||
|
||||
if (ctx->checkfree) {
|
||||
INSIST(isc_mem_inuse(ctx) == 0);
|
||||
}
|
||||
|
||||
ctx->magic = 0;
|
||||
|
||||
INSIST(ISC_LIST_EMPTY(ctx->pools));
|
||||
|
||||
#if ISC_MEM_TRACKLINES
|
||||
if (ctx->debuglist != NULL) {
|
||||
for (size_t i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
||||
|
|
@ -582,6 +576,14 @@ mem_destroy(isc_mem_t *ctx) {
|
|||
}
|
||||
#endif /* if ISC_MEM_TRACKLINES */
|
||||
|
||||
if (ctx->checkfree) {
|
||||
INSIST(isc_mem_inuse(ctx) == 0);
|
||||
}
|
||||
|
||||
ctx->magic = 0;
|
||||
|
||||
INSIST(ISC_LIST_EMPTY(ctx->pools));
|
||||
|
||||
free(ctx->name);
|
||||
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
|
|
|
|||
Loading…
Reference in a new issue