[][src]Struct slabmalloc::SCAllocator

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

A slab allocator allocates elements of a fixed size.

It has a list of ObjectPage stored inside slabs from which it allocates memory.

Methods

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

pub const fn new(
    size: usize,
    pager: &'a Mutex<dyn PageProvider<'a>>
) -> SCAllocator<'a>
[src]

Create a new SCAllocator.

pub fn size(&self) -> usize[src]

Return object size of this allocator.

pub fn insert_slab<'b>(&'b mut self, new_head: &'a mut ObjectPage<'a>)[src]

Add a new ObjectPage.

pub fn allocate<'b>(&'b mut self, layout: Layout) -> *mut u8[src]

Allocates a block of memory with respect to alignment.

In case of failure will try to grow the slab allocator by requesting additional pages and re-try the allocation once more before we give up.

pub fn deallocate<'b>(&'b mut self, ptr: *mut u8, layout: Layout)[src]

Deallocates a previously allocated block.

Bug

This never releases memory in case the ObjectPage are provided by the zone.

Auto Trait Implementations

impl<'a> Unpin for SCAllocator<'a>

impl<'a> Send for SCAllocator<'a>

impl<'a> Sync for SCAllocator<'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]