pub struct TrackingAllocator<A = System> { /* private fields */ }Expand description
An allocator that tracks allocations and deallocations.
The allocator works by tagging each allocation with a group ID in the first 8 bytes of the allocation.
Allocations are first tracked for each thread locally then periodically
reported to the global tracker via flush_thread_statistics.
The allocations and deallocations are only reported if a group ID is set, however the tagging is always done, so a tiny memory and bookkeeping overhead is incurred.
Implementations§
Source§impl<A> TrackingAllocator<A>
impl<A> TrackingAllocator<A>
Trait Implementations§
Source§impl<A: GlobalAlloc> GlobalAlloc for TrackingAllocator<A>
impl<A: GlobalAlloc> GlobalAlloc for TrackingAllocator<A>
Source§unsafe fn alloc(&self, object_layout: Layout) -> *mut u8
unsafe fn alloc(&self, object_layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<A> Freeze for TrackingAllocator<A>where
A: Freeze,
impl<A> RefUnwindSafe for TrackingAllocator<A>where
A: RefUnwindSafe,
impl<A> Send for TrackingAllocator<A>where
A: Send,
impl<A> Sync for TrackingAllocator<A>where
A: Sync,
impl<A> Unpin for TrackingAllocator<A>where
A: Unpin,
impl<A> UnsafeUnpin for TrackingAllocator<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for TrackingAllocator<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