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.c:142:
// want the bookkeeping cost.
static const DebugFreedEntry *debug_freed_find(const DebugAllocator *dbg, void *ptr) {
for (u32 i = 0; i < dbg->freed.length; i++) {
if (dbg->freed.data[i].ptr == ptr)- In
Debug.c:222:
// them, then abort -- the freed-history hit is conclusive
// evidence of a double-free.
const DebugFreedEntry *fe = debug_freed_find(dbg, ptr);
if (fe) {
LOG_ERROR(- In
Debug.c:260:
// call site. Unbounded; gated by track_freed_history config.
if (dbg->config.track_freed_history) {
DebugFreedEntry entry;
entry.ptr = ptr;
entry.requested_size = live_rec->requested_size;- In
Debug.h:94:
StackFrame alloc_trace[DEBUG_ALLOCATOR_MAX_TRACE];
StackFrame free_trace[DEBUG_ALLOCATOR_MAX_TRACE];
} DebugFreedEntry;
typedef Vec(DebugFreedEntry) DebugFreedVec;- In
Debug.h:96:
} DebugFreedEntry;
typedef Vec(DebugFreedEntry) DebugFreedVec;
///
Last updated on