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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.