Crate slabmalloc
source · [−]Expand description
A slab allocator implementation for objects less than a page-size (4 KiB or 2MiB).
Overview
The organization is as follows:
- A
ZoneAllocator
manages manySCAllocator
and can satisfy requests for different allocation sizes. - A
SCAllocator
allocates objects of exactly one size. It stores the objects and meta-data in one or multipleAllocablePage
objects. - A trait
AllocablePage
that defines the page-type from which we allocate objects.
Lastly, it provides two default AllocablePage
implementations ObjectPage
and LargeObjectPage
:
- A
ObjectPage
that is 4 KiB in size and contains allocated objects and associated meta-data. - A
LargeObjectPage
that is 2 MiB in size and contains allocated objects and associated meta-data.
Implementing GlobalAlloc
See the global alloc example.
Structs
Holds allocated data within a 2 MiB page.
Holds allocated data within a 4 KiB page.
Rawlink is a type like Option
A slab allocator allocates elements of a fixed size.
A zone allocator for arbitrary sized allocations.
Enums
Error that can be returned for allocation
and deallocation
requests.
Traits
This trait is used to define a page from which objects are allocated
in an SCAllocator
.
Allocator trait to be implemented by users of slabmalloc to provide memory to slabmalloc.