Crate hala_pprof_memory
source ·Expand description
An implementation of GlobalAlloc
that supports memory profiling
and whose output reports are compatible with pprof
.
The below code enables memory profiling in rust programs.
use hala_pprof_memory::PprofAlloc;
#[global_allocator]
static ALLOC: PprofAlloc = PprofAlloc(10);
PprofAlloc
does not automatically generate memory profiling reports,
the developers need to manually call snapshot
function to generate them.
use hala_pprof_memory::{PprofAlloc,snapshot};
#[global_allocator]
static ALLOC: PprofAlloc = PprofAlloc(10);
fn main() {
loop {
// working...
// generate report.
snapshot();
}
}
Structs§
- An implementation of
GlobalAlloc
that supports memory profiling.