Skip to content

timblechmann/nova_memoryresource

Repository files navigation

nova::memoryresource

CI

C++ std::pmr::memory_resource implementations for various allocators.

Highlight: TLSF Memory Resource

The tlsf_memory_resource is a real-time safe memory allocator powered by the Two-Level Segregated Fit (TLSF) algorithm. It provides $O(1)$ constant time allocation and deallocation guarantees.

Components

Type Backend Notes
tlsf_memory_resource tlsf Real-time safe, $O(1)$ allocations. Excellent for audio threads.
mimalloc_memory_resource mimalloc Backed by a purely-local mi_heap_t. Requires mimalloc v3.

Usage

#include <nova/pmr/tlsf_memory_resource.hpp>

// Utilize a real-time safe static array of 64KB backing the TLSF pool
nova::pmr::static_tlsf_memory_resource<65536> mr;
std::pmr::vector<int> v({1, 2, 3}, &mr);

Requirements

  • C++20 (GCC 12+, Clang 20+, MSVC 2022+)

Build & test

cmake -B build
cmake --build build
ctest --test-dir build

License

MIT — see LICENSE

About

TLSF/mimalloc based std::memory_resource implementations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors