pub struct AllocationDelta {
pub allocations: usize,
pub deallocations: usize,
pub reallocations: usize,
pub bytes_allocated: usize,
pub bytes_deallocated: usize,
}Expand description
Counts of allocator calls and the bytes they moved.
Every field is an exact tally of what the calling thread did, modulo
usize::MAX + 1 (the counters wrap rather than panic, because a panic
inside a global allocator aborts the process). A window that moves fewer
than usize::MAX bytes reads exactly.
Default is the empty delta, the value a window that never touched the
heap reads.
Fields§
§allocations: usizeSuccessful alloc and alloc_zeroed calls.
deallocations: usizedealloc calls.
reallocations: usizeSuccessful realloc calls.
bytes_allocated: usizeBytes acquired: the size of every successful allocation, plus the growth
of every successful realloc to a larger size.
bytes_deallocated: usizeBytes released: the size of every deallocated block, plus the shrinkage
of every successful realloc to a smaller size.
Implementations§
Source§impl AllocationDelta
impl AllocationDelta
Sourcepub const fn bytes_retained(&self) -> isize
pub const fn bytes_retained(&self) -> isize
Net heap growth over the window: Self::bytes_allocated minus
Self::bytes_deallocated, signed.
Positive when the window retained memory, negative when it released
memory acquired before the window began, zero when it was balanced.
Exact while the magnitude is below isize::MAX.