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.
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
mallocpath. - 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.
The results demonstrate that specialization significantly outperforms generalization:
- Speed: It achieved a geometric mean speedup of 1.17× over
dlmallocon SPEC CPU2017 and a massive 1.93× onmimalloc-benchcompared tomimalloc. - Memory Efficiency: Exgen-Malloc saved 6.2% memory on SPEC CPU2017 and 25.2% on
mimalloc-benchcompared to Microsoft’smimalloc. - 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