Expand description
Rust global allocator support for the in-tree mimalloc build.
use mimalloc_pprof::{prof, MiMalloc};
#[global_allocator] static ALLOCATOR: MiMalloc = MiMalloc;
prof::start(512 * 1024);
prof::dump_file(std::path::Path::new("heap.prof"))?;See the README’s Rust integration guide for frame-pointer and line-table
build flags. Open the resulting profile with pprof -http=: app.exe heap.prof.
Modules§
- prof
- Safe controls for mimalloc’s sampled heap profiler.
- sys
- Raw bindings to the in-tree mimalloc static amalgamation.
Structs§
- MiMalloc
- A
#[global_allocator]implementation backed by mimalloc. - Prof
Config - Ergonomic, Rust-facing sibling of
mi_prof_config_t(include/mimalloc/profile.h) forenable_heap_profiling_with.
Enums§
- Dump
Format - Output format for
ProfConfig::dump_at_exit. - Prof
Config Mode - How
ProfConfigfields interact with the profiler’s environment variables andmi_option_*settings.
Functions§
- enable_
heap_ profiling - Turn on sampled heap profiling at the default sample rate.
- enable_
heap_ profiling_ with - Turn on sampled heap profiling using a struct-based configuration.
- expand⚠
- Try to grow an allocation in place, without moving it.
- recalloc⚠
- Grow or shrink an allocation to
count * sizebytes, zeroing any newly-exposed tail. - rezalloc⚠
- Grow or shrink an allocation, zeroing any newly-exposed tail.
- unwrapped_
free ⚠ - Free a pointer returned by
unwrapped_mallocorunwrapped_realloc. - unwrapped_
malloc ⚠ - Allocate
sizebytes from mimalloc’s raw-OS-layer “unwrapped” path. - unwrapped_
realloc ⚠ - Resize a pointer returned by
unwrapped_mallocorunwrapped_realloc. - usable_
size ⚠ - Bytes actually available in an allocation, which may exceed what was requested.