Skip to content

O(1) Heap

lbuild module: modm:o1heap

A constant-complexity memory allocator for hard real-time systems: allocation and deallocation take a constant, very low number of cycles, independent of the heap state, and the worst-case fragmentation is known in advance.

Blocks are rounded up to the next power of two, so up to half the memory can be lost to internal fragmentation and the largest block is the largest power of two that fits into the arena.

This module only provides the library. Use the modm:platform:heap module with allocator=o1heap to use it for malloc() and new.

See https://github.com/pavel-kirienko/o1heap.

This module is only available for nrf, rp, sam, stm32.

Dependencies

modm:o1heap modm_o1heap modm: o1heap modm_architecture_assert modm: architecture: assert modm_o1heap->modm_architecture_assert

Limited availability: Check with 'lbuild discover' if this module is available for your target!