Registry / utility / stats-alloc

stats-alloc

JSON →
library0.1.10rscratesunverified

An allocator wrapper that allows for instrumenting global allocators

# Cargo.toml [dependencies] stats_alloc = "0.1.10"
INSTALL
IMPORT
SIG · STATS-ALLOC
S
stats-alloc
utilityrustv0.1.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

StatsAlloc
use stats_alloc::StatsAlloc;

Wraps the global allocator to collect allocation statistics

use stats_alloc::StatsAlloc; use std::alloc::System; #[global_allocator] static GLOBAL: StatsAlloc<System> = StatsAlloc::new(System); fn main() { let stats = GLOBAL.stats(); println!("Allocations: {}", stats.allocations); }
Debug
Known issues
gotchaMust be set as global allocator before any allocations occur
fix
Place #[global_allocator] static at the top of main.rs or lib.rs
affects: >=0.1.0
Upgrade
Version history
0.1.10latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
stats-alloc — cargo add stats-alloc · libregistry