Crate accounting_allocator
source ·Expand description
accounting-allocator
is a global memory allocator wrapper which counts allocated and deallocated bytes.
Usage
use accounting_allocator::{AccountingAlloc, AllTimeAllocStats};
#[global_allocator]
static GLOBAL_ALLOCATOR: AccountingAlloc = AccountingAlloc::new();
fn main() {
let AllTimeAllocStats { alloc, dealloc, largest_alloc } = GLOBAL_ALLOCATOR.count().all_time;
println!("alloc {alloc} dealloc {dealloc} largest_alloc {largest_alloc}");
}
Structs
A global memory allocator wrapper which counts allocated and deallocated bytes.
Statistics for allocations and deallocations made with an
AccountingAlloc
for all time, across all threads.Statistics for allocations and deallocations made with an
AccountingAlloc
, across all threads.Statistics for allocations and deallocations made with an
AccountingAlloc
since the last call to
AccountingAlloc::count
, across all threads.