[][src]Struct slabmalloc::ZoneAllocator

pub struct ZoneAllocator<'a> { /* fields omitted */ }

A zone allocator.

Has a bunch of size class allocators and can serve allocation requests for many different (MAX_SIZE_CLASSES) object sizes (by selecting the right slab allocator).

Methods

impl<'a> ZoneAllocator<'a>[src]

pub const MAX_ALLOC_SIZE: usize[src]

pub const fn new() -> ZoneAllocator<'a>[src]

pub unsafe fn refill(
    &mut self,
    layout: Layout,
    new_page: &'a mut ObjectPage<'a>
) -> Result<(), AllocationError>
[src]

Refills the SCAllocator for a given Layouyt with an ObjectPage.

Safety

ObjectPage needs to be emtpy etc.

pub fn allocate(
    &mut self,
    layout: Layout
) -> Result<NonNull<u8>, AllocationError>
[src]

Allocate a pointer to a block of memory of size size with alignment align.

Can return None in case the zone allocator can not satisfy the allocation of the requested size or if we do not have enough memory. In case we are out of memory we try to refill the slab using our local pager and re-try the allocation request once more before we give up.

pub fn deallocate(
    &mut self,
    ptr: NonNull<u8>,
    layout: Layout
) -> Result<(), AllocationError>
[src]

Deallocates a pointer to a block of memory previously allocated by allocate.

Arguments

  • ptr - Address of the memory location to free.
  • old_size - Size of the block.
  • align - Alignment of the block.

Auto Trait Implementations

impl<'a> Unpin for ZoneAllocator<'a>

impl<'a> Send for ZoneAllocator<'a>

impl<'a> Sync for ZoneAllocator<'a>

impl<'a> !UnwindSafe for ZoneAllocator<'a>

impl<'a> RefUnwindSafe for ZoneAllocator<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]