Skip to main content

Crate pprof_alloc

Crate pprof_alloc 

Source
Expand description

Allocation profiling and Linux memory telemetry for Rust services.

pprof-alloc provides a GlobalAlloc wrapper that can sample allocation stack traces and export them as gzipped pprof heap profiles. It also exposes Linux memory collectors for allocator state, cgroup v2 memory accounting, and /proc/self/smaps_rollup process residency.

The crate is intended to be embedded in binaries that expose their own debug or metrics endpoint. Use PprofAlloc as the process global allocator, then call generate_pprof or snapshot from your application surface.

Modules§

allocator
stats

Macros§

declare_allocator_kind

Structs§

MemorySnapshot
Best-effort snapshot of allocation and memory state for the current process created by snapshot().
PprofAlloc
Global allocator wrapper that can collect allocation counters and pprof heap profiles.
PprofSummary
Summary of the currently recorded pprof allocation profile.

Enums§

CaptureMode

Constants§

DEFAULT_PPROF_SAMPLE_RATE
Default average number of allocated bytes between recorded pprof samples.
PPROF_SAMPLE_RATE_ENV
Environment variable read by PprofAlloc::with_pprof_sample_rate_from_env.

Functions§

allocation_stats
Return a snapshot of coarse process-wide allocation counters.
capture_mode
Return the stack capture mode compiled into this build.
generate_pprof
snapshot
Capture a best-effort process memory snapshot.