#[repr(C)]
pub struct ObjectPage8k<'a> { 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§

§heap_id: usize

Trait Implementations§

source§

impl<'a> AllocablePage for ObjectPage8k<'a>

source§

fn clear_metadata(&mut self)

clears the metadata section of the page

source§

const SIZE: usize = 8_192usize

The total size (in bytes) of the page. Read more
source§

const METADATA_SIZE: usize = 88usize

source§

const HEAP_ID_OFFSET: usize = 8_104usize

source§

fn set_heap_id(&mut self, heap_id: usize)

source§

fn heap_id(&self) -> usize

source§

fn bitfield(&self) -> &[AtomicU64; 8]

source§

fn bitfield_mut(&mut self) -> &mut [AtomicU64; 8]

source§

fn prev(&mut self) -> &mut Rawlink<Self>

source§

fn next(&mut self) -> &mut Rawlink<Self>

source§

fn buffer_size() -> usize

source§

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

Tries to allocate an object within this page. Read more
source§

fn is_full(&self) -> bool

Checks if we can still allocate more objects of a given layout within the page.
source§

fn is_empty(&self, relevant_bits: usize) -> bool

Checks if the page has currently no allocations.
source§

fn deallocate( &self, ptr: NonNull<u8>, layout: Layout ) -> Result<(), &'static str>

Deallocates a memory object within this page.
source§

impl<'a> Debug for ObjectPage8k<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Default for ObjectPage8k<'a>

source§

fn default() -> ObjectPage8k<'a>

Returns the “default value” for a type. Read more
source§

impl<'a> Send for ObjectPage8k<'a>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.