pub struct Stats {
pub allocations: usize,
pub deallocations: usize,
pub reallocations: usize,
pub bytes_allocated: usize,
pub bytes_deallocated: usize,
pub bytes_reallocated: isize,
}Expand description
Allocator statistics
Fields§
§allocations: usizeCount of allocation operations
deallocations: usizeCount of deallocation operations
reallocations: usizeCount of reallocation operations
An example where reallocation may occur: resizing of a Vec<T> when
its length would excceed its capacity. Excessive reallocations may
indicate that resizable data structures are being created with
insufficient or poorly estimated initial capcities.
let mut x = Vec::with_capacity(1);
x.push(0);
x.push(1); // Potential reallocationbytes_allocated: usizeTotal bytes requested by allocations
bytes_deallocated: usizeTotal bytes freed by deallocations
bytes_reallocated: isizeTotal of bytes requested minus bytes freed by reallocations
This number is positive if the total bytes requested by reallocation operations is greater than the total bytes freed by reallocations. A positive value indicates that resizable structures are growing, while a negative value indicates that such structures are shrinking.
Trait Implementations§
Source§impl SubAssign for Stats
impl SubAssign for Stats
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more