A public domain, cross-platform, lock-free thread caching memory allocator with 16-byte alignment, implemented in C.
rpmalloc is a high-performance, lock-free memory allocator implemented in C. It solves the problem of memory allocation contention in multithreaded applications by providing per-thread caches and 16-byte aligned allocations. It's designed to be faster than popular alternatives like tcmalloc, hoard, and ptmalloc3 while maintaining low memory overhead.
System programmers, game developers, and embedded engineers building performance-critical multithreaded applications in C or C++ that require efficient memory management.
Developers choose rpmalloc for its combination of lock-free design, cross-platform compatibility, and superior performance metrics. Its single-file implementation and public domain/MIT licensing make it exceptionally easy to integrate and modify compared to more complex allocators.
Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in 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.
Each thread has its own heap and cache, eliminating locks and minimizing contention in multithreaded environments, as highlighted in the README for high-performance applications.
Implemented in a single ~2200-line C source file, making it easier to read, modify, and integrate compared to complex allocators like tcmalloc or hoard.
All allocations are naturally 16-byte aligned, which is ideal for SIMD instructions and modern CPU architectures without extra overhead.
Supports Windows, Linux, macOS, iOS, and Android with configurable memory mapping backends, including huge page support for reduced TLB misses.
The library assumes valid inputs and does not guard against errors, such as passing invalid pointers to free, which can lead to segmentation faults or undefined behavior.
On POSIX systems, it oversizes memory mappings to ensure alignment, potentially wasting virtual address space, which is a caveat mentioned in the README.
In worst-case scenarios with many unfilled size classes, memory usage can be inefficient, requiring manual configuration tweaks that add complexity.