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§
- Large
Object Page - Holds allocated data within a 2 MiB page.
- Object
Page - Holds allocated data within a 4 KiB page.
- Rawlink
- Rawlink is a type like Option
but for holding a raw pointer. - SCAllocator
- A slab allocator allocates elements of a fixed size.
- Zone
Allocator - A zone allocator for arbitrary sized allocations.
Enums§
- Allocation
Error - Error that can be returned for
allocation
anddeallocation
requests.
Traits§
- Allocable
Page - This trait is used to define a page from which objects are allocated
in an
SCAllocator
. - Allocator
- Allocator trait to be implemented by users of slabmalloc to provide memory to slabmalloc.