Old is Gold: Optimizing Single-threaded Applications with Exgen-Malloc

Ruihao Li, Lizy K. John, Neeraja J. Yadwadkar · DOI

Abstract

Modern memory allocators are primarily optimized for multi-threaded workloads, introducing significant overhead for single-threaded applications. This paper introduces Exgen-Malloc, a specialized allocator that eliminates concurrency-related "baggage" while incorporating modern optimization techniques. By returning to a centralized design and stripping away synchronization primitives, Exgen-Malloc achieves up to 1.93× speedups and 25% memory savings over state-of-the-art multi-threaded allocators like mimalloc and jemalloc.

The "Datacenter Tax" of Generalization

In hyperscale computing, even minor efficiency gains in low-level system utilities can lead to massive cost savings. This hidden performance cost is often referred to as the "datacenter tax." For decades, memory allocator research has focused almost exclusively on multi-threaded designs (e.g., tcmalloc, jemalloc) to mitigate contention in multi-core processors.

The evolution of memory allocators shows a significant research gap in advanced single-threaded techniques since the late 1990s.

However, many critical workloads—such as Redis, serverless functions, and various data compression algorithms—remain single-threaded. When these applications use general-purpose multi-threaded allocators, they pay for unused features. This results in "cache pollution," where complex allocator metadata displaces application data, and unnecessary control logic overhead that slows down the critical path of memory allocation.

Architectural Specialization: Exgen-Malloc

Exgen-Malloc bridges the gap between legacy single-threaded allocators like dlmalloc and modern high-performance designs. It adopts several key architectural choices to maximize efficiency for single-threaded environments:

  • Centralized Heap & Single Free-Block List: Unlike modern allocators that maintain complex per-thread heaps and multiple free lists (local, shared, and free), Exgen-Malloc uses a single unified heap and one free list. This improves data locality and simplifies the malloc path.
  • Aggregated Metadata: Metadata is grouped with data to reduce cache misses, a technique borrowed from modern multi-threaded designs but simplified for single-threaded use.
  • Bitmaps & Fine-grained Size Classes: The allocator uses bitmaps for $O(1)$ allocation lookups and 8-byte step size classes to minimize internal fragmentation.
  • Link-Time Specialization: To ensure ease of use, the authors propose a workflow that detects at link-time if an application uses pthread. If not, the system automatically swaps the default allocator for the specialized Exgen-Malloc.

Key Results and Performance

Exgen-Malloc was evaluated against both legacy and state-of-the-art allocators on Intel Xeon platforms using SPEC CPU2017, redis-benchmark, and mimalloc-bench suites.

Exgen-Malloc occupies a superior position in the speed-memory trade-off space compared to both legacy and modern multi-threaded allocators.

The results demonstrate that specialization significantly outperforms generalization:

  • Speed: It achieved a geometric mean speedup of 1.17× over dlmalloc on SPEC CPU2017 and a massive 1.93× on mimalloc-bench compared to mimalloc.
  • Memory Efficiency: Exgen-Malloc saved 6.2% memory on SPEC CPU2017 and 25.2% on mimalloc-bench compared to Microsoft’s mimalloc.
  • Hardware Efficiency: Analysis showed a 98.6% reduction in Data TLB misses compared to dlmalloc, as the single-list approach keeps the memory "working set" smaller and more local to the CPU core.

Conclusion and Future Work

Exgen-Malloc proves that "one-size-fits-all" software is often a performance trap. By specializing for the single-threaded model, developers can reclaim significant performance lost to multi-threaded overhead. While the current model relies on link-time detection and may face fragmentation challenges with very large allocations, it represents a vital step toward more efficient, specialized system utilities in the datacenter.

Summary updated

BibTeX
@article{li2025old,
  author = {Ruihao Li and Lizy K. John and Neeraja J. Yadwadkar},
  title = {{Old is Gold: Optimizing Single-threaded Applications with Exgen-Malloc}},
  journal = {IEEE Comput. Archit. Lett.},
  year = {2025},
  doi = {10.1109/lca.2025.3587582},
}
Figure