Expand description
A slab allocator implementation for objects less than a page-size (4 KiB or 2MiB).
§Overview
The organization is as follows:
- A
ZoneAllocatormanages manySCAllocatorand can satisfy requests for different allocation sizes. - A
SCAllocatorallocates objects of exactly one size. It stores the objects and meta-data in one or multipleAllocablePageobjects. - A trait
AllocablePagethat defines the page-type from which we allocate objects.
Lastly, it provides two default AllocablePage implementations ObjectPage and LargeObjectPage:
- A
ObjectPagethat is 4 KiB in size and contains allocated objects and associated meta-data. - A
LargeObjectPagethat 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
allocationanddeallocationrequests.
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.