[][src]Crate slabmalloc

A slab allocator implementation for objects less than a page-size (4 KiB or 2MiB).

Overview

The organization is as follows:

  • A ZoneAllocator manages many SCAllocator 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 multiple AllocablePage 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

LargeObjectPage

Holds allocated data within a 2 MiB page.

ObjectPage

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.

ZoneAllocator

A zone allocator for arbitrary sized allocations.

Enums

AllocationError

Error that can be returned for allocation and deallocation requests.

Traits

AllocablePage

This trait is used to define a page from which objects are allocated in an SCAllocator.