Skip to main content

Module debug_alloc

Module debug_alloc 

Source
Expand description

Debug-only host allocation tracker.

Activated via --features debug-alloc. Wraps the global allocator to count host-side heap allocations during steady-state processing.

§Usage

#[cfg(feature = "debug-alloc")]
{
    crate::debug_alloc::reset();
    crate::debug_alloc::enable();
    // ... inference stage runs one frame ...
    crate::debug_alloc::disable();
    let count = crate::debug_alloc::count();
    assert_eq!(count, 0, "host allocations during inference: {count}");
}

Does NOT affect release builds (feature-gated, zero-cost when disabled).

Functions§

count
disable
enable
reset