Component-local allocators

The interface for allocating component-local memory at byte granularity is defined at base/memory.h.

Genode::Memory::Constrained_allocator

In contrast to the allocation of physical RAM that refers to a dataspace, a memory allocation is represented by a component-local pointer and size in bytes. The most common case of constructing a new object at dynamically allocated memory is covered by the Constrained_obj_allocator<T>.

Genode::Memory::Constrained_obj_allocator

The create method constructs an object on backing store allocated from a constrained memory allocator. Constructor arguments are passed as arguments to create.

In contrast to the traditional new operator, the create method reflects allocation errors as return values instead of exceptions.

An object is destructed at deallocation time.

In contrast to the traditional delete operator, which accepts the object type of a base class of the allocated object as argument, the type for the deallocation has to correspond to the allocated type.

Slab allocator

The Slab allocator is tailored for allocating small fixed-size memory blocks from a big chunk of memory. For the common use case of using a slab allocator for a certain type rather than for a known byte size, there exists a typed slab allocator as a front end of Slab.

Genode::Slab

Genode::Tslab

AVL-tree-based best-fit allocator

In contrast to the rather limited slab allocators, Allocator_avl allows for arbitrary allocations from a list of address regions. It implements a best-fit allocation strategy, supports arbitrary alignments, and allocations at specified addresses.

Genode::Allocator_avl_base

Genode::Allocator_avl_tpl

Heap and sliced heap

Genode::Heap

Genode::Sliced_heap