Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. rpmalloc

rpmalloc

MITC2.0.1

A public domain, cross-platform, lock-free thread caching memory allocator with 16-byte alignment, implemented in C.

GitHubGitHub
2.5k stars210 forks0 contributors

What is rpmalloc?

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.

Target Audience

System programmers, game developers, and embedded engineers building performance-critical multithreaded applications in C or C++ that require efficient memory management.

Value Proposition

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.

Overview

Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

Use Cases

Best For

  • High-performance game engines requiring low-latency memory allocation
  • Multithreaded server applications needing to minimize lock contention
  • Embedded systems development where memory overhead must be controlled
  • Cross-platform C/C++ projects targeting Windows, Linux, and mobile OS
  • Applications using SIMD instructions that require 16-byte aligned memory
  • Replacing default allocators in existing codebases for performance gains

Not Ideal For

  • Single-threaded applications where lock-free caching adds unnecessary overhead
  • Safety-critical systems requiring built-in memory validation and error handling
  • Environments with extremely limited virtual address space due to mmap oversizing
  • Projects needing advanced allocator features like garbage collection or detailed profiling out of the box

Pros & Cons

Pros

Lock-Free Performance

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.

Single-File Simplicity

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.

Natural 16-Byte Alignment

All allocations are naturally 16-byte aligned, which is ideal for SIMD instructions and modern CPU architectures without extra overhead.

Cross-Platform Flexibility

Supports Windows, Linux, macOS, iOS, and Android with configurable memory mapping backends, including huge page support for reduced TLB misses.

Cons

Minimal Error Handling

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.

Virtual Memory Overhead

On POSIX systems, it oversizes memory mappings to ensure alignment, potentially wasting virtual address space, which is a caveat mentioned in the README.

Complex Cache Management

In worst-case scenarios with many unfilled size classes, memory usage can be inefficient, requiring manual configuration tweaks that add complexity.

Frequently Asked Questions

Quick Stats

Stars2,475
Forks210
Contributors0
Open Issues5
Last commit8 days ago
CreatedSince 2016

Tags

#c-library#embedded#memory-allocator#memory#low-latency#lock-free#multithreading#allocator#cross-platform#thread#concurrency#system-programming#performance

Built With

C
C++

Included in

C/C++70.6k
Auto-fetched 7 hours ago

Related Projects

mimallocmimalloc

mimalloc is a compact general purpose allocator with excellent performance.

Stars13,215
Forks1,140
Last commit13 hours ago
jemallocjemalloc

General purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. [BSD] website

Stars11,008
Forks1,636
Last commit16 hours ago
TCMallocTCMalloc

TCMalloc is Google's customized implementation of C's `malloc()` and C++'s `operator new` for memory allocation within C and C++ code. It provides a high-performance alternative to standard memory allocators, optimized for multi-threaded applications where allocation speed and scalability are critical. ## Key Features - **Fast Allocation** — Optimized for speed with efficient memory management algorithms - **Multi-threaded Performance** — Designed to scale well in concurrent environments - **Customizable Configuration** — Tunable parameters for different workload requirements - **Comprehensive API** — Full support for C and C++ memory allocation interfaces - **Platform Support** — Available across multiple operating systems and architectures ## Philosophy TCMalloc prioritizes performance and scalability in multi-threaded environments while maintaining compatibility with standard memory allocation interfaces, making it suitable for production systems with demanding memory allocation patterns.

Stars5,292
Forks559
Last commit8 hours ago
Boehm GCBoehm GC

The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (bdwgc, also known as bdw-gc, boehm-gc, libgc)

Stars3,506
Forks441
Last commit20 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub