Struct slabmalloc::ObjectPage8k
source · #[repr(C)]pub struct ObjectPage8k<'a> {
pub mp: Option<MappedPages8k>,
pub heap_id: usize,
/* private fields */
}
Expand description
Holds allocated data within 2 4-KiB pages.
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 8 KiB.
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).
Fields§
§mp: Option<MappedPages8k>
The MappedPages this memory area belongs to
heap_id: usize
Trait Implementations§
source§impl<'a> AllocablePage for ObjectPage8k<'a>
impl<'a> AllocablePage for ObjectPage8k<'a>
source§fn new(mp: MappedPages8k, heap_id: usize) -> ObjectPage8k<'a>
fn new(mp: MappedPages8k, heap_id: usize) -> ObjectPage8k<'a>
Creates a new 8KiB allocable page and stores the MappedPages object in the metadata portion.
source§fn retrieve_mapped_pages(&mut self) -> Option<MappedPages8k>
fn retrieve_mapped_pages(&mut self) -> Option<MappedPages8k>
Returns the MappedPages object that was stored in the metadata portion of the page.
source§fn clear_metadata(&mut self)
fn clear_metadata(&mut self)
clears the metadata section of the page
const METADATA_SIZE: usize = 128usize
const HEAP_ID_OFFSET: usize = 8_104usize
fn set_heap_id(&mut self, heap_id: usize)
fn heap_id(&self) -> usize
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>
fn buffer_size() -> usize
source§fn 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.source§fn 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
source§fn is_full(&self) -> bool
fn is_full(&self) -> bool
Checks if we can still allocate more objects of a given layout within the page.
source§impl<'a> Debug for ObjectPage8k<'a>
impl<'a> Debug for ObjectPage8k<'a>
source§impl<'a> Default for ObjectPage8k<'a>
impl<'a> Default for ObjectPage8k<'a>
source§fn default() -> ObjectPage8k<'a>
fn default() -> ObjectPage8k<'a>
Returns the “default value” for a type. Read more
impl<'a> Send for ObjectPage8k<'a>
impl<'a> Sync for ObjectPage8k<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for ObjectPage8k<'a>
impl<'a> Unpin for ObjectPage8k<'a>
impl<'a> UnwindSafe for ObjectPage8k<'a>
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