Skip to content
DebugAllocatorInit

DebugAllocatorInit

Description

Construct a DebugAllocator with DEBUG_ALLOCATOR_DEFAULTS (all diagnostics on except page-backed UAF detection). The most common entry point for callers that just want leak + canary + trace tracking layered on top of HeapAllocator.

Success

Returns a fully-initialised DebugAllocator value with the defaults baseline; same post-init state as DebugAllocatorInitWith(DEBUG_ALLOCATOR_DEFAULTS).

Failure

Cannot fail at macro-expansion time.

Usage example (Cross-references)

Usage examples (Cross-references)
    
    bool test_debug_normal_alloc_free(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_zero_byte_alloc(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_null_free_is_noop(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_catches_overflow(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_leak_count(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_report_leaks_emits_traces(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_alloc_trace_captured(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_freed_history_grows_on_free(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_remap_grows(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_remap_to_zero_frees(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_remap_from_null_allocates(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
    
    bool test_debug_double_free_aborts(void) {
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
        // live map -> forwarded to underlying Heap, which LOG_FATALs as
        // foreign pointer.
        DebugAllocator dbg  = DebugAllocatorInit();
        Allocator     *adbg = ALLOCATOR_OF(&dbg);
                                                                .track_freed_history = true}))
    #    else
    #        define DefaultAllocatorInit() DebugAllocatorInit()
    #    endif
    #else
Last updated on