pub struct AccountingAlloc<A = System> { /* private fields */ }
Expand description

A global memory allocator wrapper which counts allocated and deallocated bytes.

Implementations

Create a new AccountingAlloc using the System allocator.

Create a new AccountingAlloc using the given allocator A.

Note that in order for AccountingAlloc<A> to implement GlobalAlloc, A must implement GlobalAlloc.

Return the latest statistics for this allocator.

Increment the current thread’s (de)allocated bytes count by alloc and dealloc.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Display the number of bytes each live thread has allocated and deallocated over all time, along with the global total.

Formats the value using the given formatter. Read more
Allocate memory as described by the given layout. Read more
Deallocate the block of memory at the given ptr pointer with the given layout. Read more
Behaves like alloc, but also ensures that the contents are set to zero before being returned. Read more
Shrink or grow a block of memory to the given new_size. The block is described by the given ptr pointer and layout. 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.

Converts the given value to a String. 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.