DebugAllocatorDestroy
Description
Tear down a DebugAllocator. Iterates the live map first and emits a LOG_ERROR for every still-live allocation, including its captured alloc trace.
Parameters
| Name | Direction | Description |
|---|---|---|
self |
in | Handle returned by DebugAllocatorCreate*. |
meta_alloc |
in | Same allocator that was passed at create time. |
Success
Function returns. The handle is invalid after this call; leak count is available via the live_at_destroy return prior to teardown if the caller called DebugAllocatorLiveCount first.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
AllocDebug.c:36:
ok = ok && DebugAllocatorOverflows(dbg) == 0;
DebugAllocatorDestroy(dbg, ALLOCATOR_OF(&meta));
HeapAllocatorDeinit(&meta);
HeapAllocatorDeinit(&backing);- In
AllocDebug.c:57:
bool ok = DebugAllocatorDoubleFrees(dbg) == 1;
DebugAllocatorDestroy(dbg, ALLOCATOR_OF(&meta));
HeapAllocatorDeinit(&meta);
HeapAllocatorDeinit(&backing);- In
AllocDebug.c:80:
bool ok = DebugAllocatorOverflows(dbg) == 1;
DebugAllocatorDestroy(dbg, ALLOCATOR_OF(&meta));
HeapAllocatorDeinit(&meta);
HeapAllocatorDeinit(&backing);- In
AllocDebug.c:104:
// parent and log the two leaks — but it tears down the tracking
// map. Capture the count first.
DebugAllocatorDestroy(dbg, ALLOCATOR_OF(&meta));
// backing is HeapAllocator — it does not detect the leak itself;
- In
Debug.c:318:
}
void DebugAllocatorDestroy(DebugAllocator *self, Allocator *meta_alloc) {
if (!self) {
return;
Last updated on