A single-header buddy memory allocator for C and C++ with bounded performance and predictable metadata overhead.
buddy_alloc is a single-header buddy memory allocator for C and C++ that provides predictable allocation and deallocation behavior with bounded performance and fixed metadata overhead. It is designed for use in systems where traditional allocators may not meet strict timing or storage requirements, such as embedded environments, game consoles, or kernels.
Developers working on embedded systems, game engines, operating system kernels, or any C/C++ project requiring deterministic memory allocation with minimal fragmentation and reliable performance bounds.
It offers guaranteed bounded allocation/deallocation costs and predictable metadata size, unlike general-purpose allocators, making it ideal for real-time and resource-constrained applications. Its single-header design and portability across compilers and platforms simplify integration.
A single header buddy memory allocator for C & C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allocation and deallocation costs are predictable and bounded, as stated in the README, making it ideal for time-sensitive systems like games or kernels.
Metadata size is a fixed function of arena and minimum allocation sizes, not dependent on allocator state, ensuring reliable resource planning.
It is C99-compatible, endian-agnostic, and supports multiple compilers including GCC, Clang, and MSVC, as per the features list.
Supports metadata embedded within the arena via buddy_embed, allowing for serialization or replication across processes or machines.
The README explicitly states it is not designed for multi-threaded use without additional locking, requiring users to implement synchronization externally.
Due to the buddy system's power-of-two block sizes, allocations are rounded up, leading to potential memory waste for non-power-of-two requests.
The arena size must be predefined and resized manually, which can be inflexible for applications with highly dynamic memory needs.