DebugAllocatorFreedCount
Description
Number of entries currently held in the freed-history ring (only populated when track_freed_history is enabled in the DebugAllocator’s config). Each entry carries the original alloc + first-free stack traces used by the double-free diagnostic.
Parameters
| Name | Direction | Description |
|---|---|---|
self |
in | DebugAllocator instance, or NULL. |
Success
Returns the freed-history entry count.
Failure
Returns 0 when self is NULL, or when freed-history tracking is disabled.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Debug.c:516:
}
size DebugAllocatorFreedCount(const DebugAllocator *self) {
if (!self)
return 0;- In
AllocDebug.c:171:
Allocator *adbg = ALLOCATOR_OF(&dbg);
bool ok = (DebugAllocatorFreedCount(&dbg) == 0);
void *p1 = AllocatorAlloc(adbg, 16, false);
void *p2 = AllocatorAlloc(adbg, 32, false);- In
AllocDebug.c:175:
void *p2 = AllocatorAlloc(adbg, 32, false);
void *p3 = AllocatorAlloc(adbg, 64, false);
ok = ok && (DebugAllocatorFreedCount(&dbg) == 0); // alloc doesn't push
AllocatorFree(adbg, p1);- In
AllocDebug.c:178:
AllocatorFree(adbg, p1);
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
AllocatorFree(adbg, p2);- In
AllocDebug.c:182:
AllocatorFree(adbg, p2);
AllocatorFree(adbg, p3);
ok = ok && (DebugAllocatorFreedCount(&dbg) == 3);
// intentional bypass: the freed-history Vec elements are internal
- In
AllocDebug.c:212:
AllocatorFree(adbg, p);
}
ok = ok && (DebugAllocatorFreedCount(&dbg) == 0);
ok = ok && (DebugAllocatorLiveCount(&dbg) == 0);
Last updated on