pub struct NumaLocal<I: OsBacked> { /* private fields */ }Expand description
NumaLocal wrapper.
Implementations§
Source§impl<I: OsBacked> NumaLocal<I>
impl<I: OsBacked> NumaLocal<I>
Sourcepub fn new(inner: I, policy: NumaPolicy) -> Result<Self, AllocError>
pub fn new(inner: I, policy: NumaPolicy) -> Result<Self, AllocError>
Wrap and apply policy to the inner allocator’s region.
Returns Err(AllocError) if the platform supports NUMA and the
kernel rejects the bind (insufficient capability, invalid node
id, no memory available on the bound nodes). On unsupported
platforms (macOS, Windows, other) returns Ok without binding
— caller can inspect with policy but the
region’s physical placement is the kernel’s default.
Sourcepub fn policy(&self) -> &NumaPolicy
pub fn policy(&self) -> &NumaPolicy
Active policy.
Trait Implementations§
Source§impl<I: OsBacked> Allocator for NumaLocal<I>
impl<I: OsBacked> Allocator for NumaLocal<I>
Source§fn allocate(&self, layout: NonZeroLayout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: NonZeroLayout) -> Result<NonNull<[u8]>, AllocError>
Allocate a block satisfying
layout. The returned slice’s length is
at least layout.size() but may be larger.Source§unsafe fn usable_size(
&self,
ptr: NonNull<u8>,
layout: NonZeroLayout,
) -> Option<usize>
unsafe fn usable_size( &self, ptr: NonNull<u8>, layout: NonZeroLayout, ) -> Option<usize>
Usable size of an existing allocation, if the allocator can report
it. Defaults to
None — implementors that track usable size
override. Read moreSource§fn capacity_bytes(&self) -> Option<usize>
fn capacity_bytes(&self) -> Option<usize>
Total bytes this allocator can issue, if bounded.
None for unbounded
allocators like System. Used by Watermark to compute thresholds.Source§fn corruption_events(&self) -> u64
fn corruption_events(&self) -> u64
Detected freelist / metadata corruption events observed by this
allocator since construction. Read more
Source§fn allocate_zeroed(
&self,
layout: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed( &self, layout: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Allocate a zero-initialized block.
Source§unsafe fn grow(
&self,
ptr: NonNull<u8>,
old: NonZeroLayout,
new: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow( &self, ptr: NonNull<u8>, old: NonZeroLayout, new: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Grow an allocation in place if possible, otherwise allocate-copy-free. Read more
Source§unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old: NonZeroLayout,
new: NonZeroLayout,
) -> Result<NonNull<[u8]>, AllocError>
unsafe fn shrink( &self, ptr: NonNull<u8>, old: NonZeroLayout, new: NonZeroLayout, ) -> Result<NonNull<[u8]>, AllocError>
Shrink an allocation in place if possible, otherwise allocate-copy-free. Read more
Source§impl<I: OsBacked> Deallocator for NumaLocal<I>
impl<I: OsBacked> Deallocator for NumaLocal<I>
Source§unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: NonZeroLayout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: NonZeroLayout)
Release a previously allocated block. Read more
Source§impl<I: OsBacked + FixedRange> FixedRange for NumaLocal<I>
impl<I: OsBacked + FixedRange> FixedRange for NumaLocal<I>
Source§impl<I: OsBacked> OsBacked for NumaLocal<I>
impl<I: OsBacked> OsBacked for NumaLocal<I>
Auto Trait Implementations§
impl<I> Freeze for NumaLocal<I>where
I: Freeze,
impl<I> RefUnwindSafe for NumaLocal<I>where
I: RefUnwindSafe,
impl<I> Send for NumaLocal<I>where
I: Send,
impl<I> Sync for NumaLocal<I>where
I: Sync,
impl<I> Unpin for NumaLocal<I>where
I: Unpin,
impl<I> UnsafeUnpin for NumaLocal<I>where
I: UnsafeUnpin,
impl<I> UnwindSafe for NumaLocal<I>where
I: 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