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§
- Accounting
Alloc - A global memory allocator wrapper which counts allocated and deallocated bytes.
- AllTime
Alloc Stats - Statistics for allocations and deallocations made with an
AccountingAlloc
for all time, across all threads. - Alloc
Stats - Statistics for allocations and deallocations made with an
AccountingAlloc
, across all threads. - Incremental
Alloc Stats - Statistics for allocations and deallocations made with an
AccountingAlloc
since the last call toAccountingAlloc::count
, across all threads.