Skip to main content

enable_heap_profiling

Function enable_heap_profiling 

Source
pub fn enable_heap_profiling() -> bool
Expand description

Turn on sampled heap profiling at the default sample rate.

Convenience entry point for wiring profiling to a command-line flag:

if args_profile_heap {
    mimalloc_pprof::enable_heap_profiling();
}

Uses the built-in default rate (one sample per ~512 KiB allocated; MIMALLOC_PROF_SAMPLE_RATE still overrides it). Call prof::start instead to pick a rate programmatically. Allocations made before this call — including process-startup and static initialization — are not tracked; profiles reflect steady-state behavior from this point on, which is the usual intent for an opt-in CLI switch. To capture startup as well, set MIMALLOC_PROF=1 in the environment instead.

Returns false if profiling was already enabled (the earlier session, and its sample rate, stay active), or if the crate was built with default-features = false.