DebugFreedEntry
Description
Bounded-history record for a successfully-freed allocation. Kept in the freed Vec ring; scanned linearly when the next free can’t find a live record, to emit the original alloc + first-free traces alongside Heap’s double-free abort.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Debug.h:100:
StackFrame alloc_trace[DEBUG_ALLOCATOR_MAX_TRACE];
StackFrame free_trace[DEBUG_ALLOCATOR_MAX_TRACE];
} DebugFreedEntry;
typedef Vec(DebugFreedEntry) DebugFreedVec;- In
Debug.h:102:
} DebugFreedEntry;
typedef Vec(DebugFreedEntry) DebugFreedVec;
///
- In
Debug.c:209:
// want the bookkeeping cost.
static const DebugFreedEntry *debug_freed_find(const DebugAllocator *dbg, void *ptr) {
for (u32 i = 0; i < VecLen(&dbg->freed); i++) {
if (VecPtrAt(&dbg->freed, i)->ptr == ptr)- In
Debug.c:320:
// them, then abort -- the freed-history hit is conclusive
// evidence of a double-free.
const DebugFreedEntry *fe = debug_freed_find(self, ptr);
if (fe) {
LOG_ERROR(- In
Debug.c:361:
// call site. Unbounded; gated by track_freed_history config.
if (self->config.track_freed_history) {
DebugFreedEntry entry;
entry.ptr = ptr;
entry.requested_size = live_rec->requested_size;- In
AllocDebug.c:409:
ok = ok && (DebugAllocatorFreedCount(&dbg) == 1);
const DebugFreedEntry *fe = VecPtrAt(&dbg.freed, 0);
bool match = ok;
for (u32 i = 0; ok && i < n; i++) {
Last updated on