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: usize
Count of allocation operations
deallocations: usize
Count of deallocation operations
reallocations: usize
Count 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 reallocation
bytes_allocated: usize
Total bytes requested by allocations
bytes_deallocated: usize
Total bytes freed by deallocations
bytes_reallocated: isize
Total 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