Struct slabmalloc::LargeObjectPage
source · [−]#[repr(C)]pub struct LargeObjectPage<'a> { /* private fields */ }
Expand description
Holds allocated data within a 2 MiB page.
Has a data-section where objects are allocated from and a small amount of meta-data in form of a bitmap to track allocations at the end of the page.
Notes
An object of this type will be exactly 2 MiB.
It is marked repr(C)
because we rely on a well defined order of struct
members (e.g., dealloc does a cast to find the bitfield).
Trait Implementations
sourceimpl<'a> AllocablePage for LargeObjectPage<'a>
impl<'a> AllocablePage for LargeObjectPage<'a>
fn bitfield(&self) -> &[AtomicU64; 8]
fn bitfield_mut(&mut self) -> &mut [AtomicU64; 8]
fn prev(&mut self) -> &mut Rawlink<Self>
fn next(&mut self) -> &mut Rawlink<Self>
sourcefn first_fit(&self, layout: Layout) -> Option<(usize, usize)>
fn first_fit(&self, layout: Layout) -> Option<(usize, usize)>
Tries to find a free block within data
that satisfies alignment
requirement.
sourcefn allocate(&mut self, layout: Layout) -> *mut u8
fn allocate(&mut self, layout: Layout) -> *mut u8
Tries to allocate an object within this page. Read more
sourcefn is_full(&self) -> bool
fn is_full(&self) -> bool
Checks if we can still allocate more objects of a given layout within the page.
sourcefn is_empty(&self, relevant_bits: usize) -> bool
fn is_empty(&self, relevant_bits: usize) -> bool
Checks if the page has currently no allocations.
sourcefn deallocate(
&self,
ptr: NonNull<u8>,
layout: Layout
) -> Result<(), AllocationError>
fn deallocate(
&self,
ptr: NonNull<u8>,
layout: Layout
) -> Result<(), AllocationError>
Deallocates a memory object within this page.
sourceimpl<'a> Debug for LargeObjectPage<'a>
impl<'a> Debug for LargeObjectPage<'a>
sourceimpl<'a> Default for LargeObjectPage<'a>
impl<'a> Default for LargeObjectPage<'a>
sourcefn default() -> LargeObjectPage<'a>
fn default() -> LargeObjectPage<'a>
Returns the “default value” for a type. Read more
impl<'a> Send for LargeObjectPage<'a>
impl<'a> Sync for LargeObjectPage<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for LargeObjectPage<'a>
impl<'a> Unpin for LargeObjectPage<'a>
impl<'a> UnwindSafe for LargeObjectPage<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more