pub struct AccountingAlloc<A = System> { /* private fields */ }
Expand description
A global memory allocator wrapper which counts allocated and deallocated bytes.
Implementations§
Source§impl AccountingAlloc<System>
impl AccountingAlloc<System>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new AccountingAlloc
using the System
allocator.
Source§impl<A> AccountingAlloc<A>
impl<A> AccountingAlloc<A>
Sourcepub const fn with_allocator(allocator: A) -> Self
pub const fn with_allocator(allocator: A) -> Self
Create a new AccountingAlloc
using the given allocator A
.
Note that in order for AccountingAlloc<A>
to implement GlobalAlloc
, A
must implement GlobalAlloc
.
Sourcepub fn count(&self) -> AllocStats
pub fn count(&self) -> AllocStats
Return the latest statistics for this allocator.
Trait Implementations§
Source§impl<A: Debug> Debug for AccountingAlloc<A>
impl<A: Debug> Debug for AccountingAlloc<A>
Source§impl<A: Default> Default for AccountingAlloc<A>
impl<A: Default> Default for AccountingAlloc<A>
Source§fn default() -> AccountingAlloc<A>
fn default() -> AccountingAlloc<A>
Returns the “default value” for a type. Read more
Source§impl<A> Display for AccountingAlloc<A>
Display the number of bytes each live thread has allocated and deallocated over all time, along with the global
total.
impl<A> Display for AccountingAlloc<A>
Display the number of bytes each live thread has allocated and deallocated over all time, along with the global total.
Source§impl<A: GlobalAlloc> GlobalAlloc for AccountingAlloc<A>
impl<A: GlobalAlloc> GlobalAlloc for AccountingAlloc<A>
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout
. Read moreAuto Trait Implementations§
impl<A = System> !Freeze for AccountingAlloc<A>
impl<A> RefUnwindSafe for AccountingAlloc<A>where
A: RefUnwindSafe,
impl<A> Send for AccountingAlloc<A>where
A: Send,
impl<A> Sync for AccountingAlloc<A>where
A: Sync,
impl<A> Unpin for AccountingAlloc<A>where
A: Unpin,
impl<A> UnwindSafe for AccountingAlloc<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more