pub struct Allocator<A: GlobalAlloc> { /* private fields */ }Expand description
A memory allocator that enables tracking of memory allocations and deallocations.
This allocator wraps any GlobalAlloc implementation to provide allocation tracking
capabilities while maintaining the same allocation behavior and performance characteristics
as the underlying allocator.
§Examples
use alloc_tracker::Allocator;
#[global_allocator]
static ALLOCATOR: Allocator<std::alloc::System> = Allocator::system();Implementations§
Source§impl<A: GlobalAlloc> Allocator<A>
impl<A: GlobalAlloc> Allocator<A>
Sourcepub const fn new(allocator: A) -> Self
pub const fn new(allocator: A) -> Self
Creates a new tracking allocator that enables allocation tracking for the provided allocator.
The resulting allocator will have the same performance and behavior characteristics as the underlying allocator, with the addition of allocation tracking capabilities.
Trait Implementations§
Source§impl<A: GlobalAlloc> Debug for Allocator<A>
impl<A: GlobalAlloc> Debug for Allocator<A>
Source§impl<A: GlobalAlloc> GlobalAlloc for Allocator<A>
impl<A: GlobalAlloc> GlobalAlloc for Allocator<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> Freeze for Allocator<A>where
A: Freeze,
impl<A> RefUnwindSafe for Allocator<A>where
A: RefUnwindSafe,
impl<A> Send for Allocator<A>where
A: Send,
impl<A> Sync for Allocator<A>where
A: Sync,
impl<A> Unpin for Allocator<A>where
A: Unpin,
impl<A> UnwindSafe for Allocator<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