pub struct Mimalloc<A: GlobalAlloc> { /* private fields */ }Expand description
The main allocator object.
A is the type of the OS allocator for segments.
To use it as the global_allocator, wrap it inside a lock and implement GlobalAlloc.
See MimallocMutexWrapper.
Implementations§
Source§impl<A: GlobalAlloc> Mimalloc<A>
impl<A: GlobalAlloc> Mimalloc<A>
Sourcepub const fn with_os_allocator(os_alloc: A) -> Self
pub const fn with_os_allocator(os_alloc: A) -> Self
Create a new Mimalloc instance with an OS allocator.
Sourcepub const fn register_deferred_free(&mut self, hook: DeferredFreeHook<A>)
Available on crate feature deferred_free only.
pub const fn register_deferred_free(&mut self, hook: DeferredFreeHook<A>)
deferred_free only.Register a hook to complete deferred free when the allocator needs more memory. A new hook replaces the old one.
See the documentation of
mi_register_deferred_free
(the extra arg is not supported).
Trait Implementations§
Source§impl<A: GlobalAlloc> Drop for Mimalloc<A>
impl<A: GlobalAlloc> Drop for Mimalloc<A>
impl<A: GlobalAlloc> Send for Mimalloc<A>
Auto Trait Implementations§
impl<A> Freeze for Mimalloc<A>where
A: Freeze,
impl<A> RefUnwindSafe for Mimalloc<A>where
A: RefUnwindSafe,
impl<A> !Sync for Mimalloc<A>
impl<A> Unpin for Mimalloc<A>where
A: Unpin,
impl<A> UnwindSafe for Mimalloc<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