Skip to content
DebugAllocatorDeinit

DebugAllocatorDeinit

Description

Tear down a DebugAllocator. Iterates live first and emits a LOG_ERROR for each still-live allocation with its captured alloc trace. Releases all backing storage (heap / meta / page-managed pages) and clears the struct.

Usage example (Cross-references)

Usage examples (Cross-references)
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
    
        DebugAllocatorDeinit(&dbg);
        return ok;
    }
        bool ok = DebugAllocatorDoubleFrees(&dbg) == 1;
    
        DebugAllocatorDeinit(&dbg);
        return ok;
    }
        bool ok = DebugAllocatorOverflows(&dbg) == 1;
    
        DebugAllocatorDeinit(&dbg);
        return ok;
    }
        // free everything via the internal heap. The leaked records are
        // surfaced before the tracking map gets torn down.
        DebugAllocatorDeinit(&dbg);
        return ok;
    }
        ok = ok && DebugAllocatorDoubleFrees(&dbg) == 1;
    
        DebugAllocatorDeinit(&dbg);
        return ok;
    }
    // ---------------------------------------------------------------------------
    
    void DebugAllocatorDeinit(DebugAllocator *self) {
        if (!self || self->base.__magic != MISRA_DEBUG_ALLOCATOR_MAGIC)
            return;
    #        define DefaultAllocatorInit() DebugAllocatorInit()
    #    endif
    #    define DefaultAllocatorDeinit(ptr) DebugAllocatorDeinit(ptr)
    #else
    #    define DefaultAllocatorInit()      HeapAllocatorInit()
Last updated on