pub struct MmapAllocator;
Expand description
Implementation of std::alloc::GlobalAlloc whose backend is mmap(2)
Implementations§
Source§impl MmapAllocator
impl MmapAllocator
Trait Implementations§
Source§impl Clone for MmapAllocator
impl Clone for MmapAllocator
Source§fn clone(&self) -> MmapAllocator
fn clone(&self) -> MmapAllocator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MmapAllocator
impl Debug for MmapAllocator
Source§impl Default for MmapAllocator
impl Default for MmapAllocator
Source§impl GlobalAlloc for MmapAllocator
§Portability
alloc() calls mmap() with flag MAP_ANONYMOUS.
Many systems support the flag, however, it is not specified in POSIX.
impl GlobalAlloc for MmapAllocator
§Portability
alloc() calls mmap() with flag MAP_ANONYMOUS. Many systems support the flag, however, it is not specified in POSIX.
§Safety
All functions are thread safe.
§Error
Each function don’t cause panic but set OS errno on error.
Note that it is not an error to deallocate pointer which is not allocated.
This is the spec of munmap(2). See man 2 munmap
for details.
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
§Panics
This method may panic if the align of layout
is greater than the kernel page align.
(Basically, kernel page align is always greater than the align of layout
that rust
generates unless the programer dares to build such a layout
on purpose.)
Source§unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
§Panics
This method can panic if the align of layout
is greater than the kernel page align.
impl Copy for MmapAllocator
Auto Trait Implementations§
impl Freeze for MmapAllocator
impl RefUnwindSafe for MmapAllocator
impl Send for MmapAllocator
impl Sync for MmapAllocator
impl Unpin for MmapAllocator
impl UnwindSafe for MmapAllocator
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