Heap Layers

[Heap Layers]
Heap Layers provides a flexible, template-based infrastructure for composing high-performance memory allocators out of C++ "layers". Heap Layers makes it easy to write high-quality custom and general-purpose memory allocators.

Heap Layers contains a number of ready-made heap components that can be plugged together with minimal effort. Memory allocators built with Heap Layers are as fast or faster than counterparts written in conventional C or C++. We have built several industrial-strength allocators using Heap Layers, including Hoard (which now includes the Heap Layers infrastructure) and DieHard.

Heap Layers can substantially outperform its only real competitor, the Vmalloc package from AT&T (the "Reconsidering Custom Memory Allocation" paper has more details). Not only is Heap Layers much higher level and simpler to use, but its use of templates also improves performance. Heap Layers both eliminates the function call overhead imposed by Vmalloc layers and yields higher quality code by exposing more optimization opportunities.


Heap Layers is available for download at https://github.com/emeryberger/Heap-Layers.

Press & Publications

Policy-Based Memory Allocation by Andrei Alexandrescu, from Dr Dobb's.
Talk by Andrei Alexandrescu: Memory Allocation: Either Love It or Hate It (or just think it’s okay)
OOPSLA 2002: Reconsidering Custom Memory Allocation
with Ben Zorn & Kathryn McKinley
Finds that a good general-purpose allocator is better than all custom allocators except regions, but these have serious problems. Introduces reaps (regions + heaps), which combine the flexibility and space efficiency of heaps with the performance of regions. Talk (PowerPoint).

PLDI 2001: Composing High-Performance Memory Allocators
with Ben Zorn & Kathryn McKinley
Introduces Heap Layers, a flexible infrastructure for building memory allocators that leverages C++ template mixins to achieve high performance.Talk (PowerPoint).

Publications using Heap Layers

CCS 2010: DieHarder: Securing the Heap
Gene Novark, Emery Berger

ASPLOS 2008: Archipelago: trading address space for reliability and security
Vitaly Lvin, Gene Novark, Emery Berger, Ben Zorn

PLDI 2008: Exterminator: Automatically Correcting Memory Errors with High Probability
Gene Novark, Emery Berger, Ben Zorn

EuroSys 2008: Samurai: protecting critical data in unsafe languages
Karthik Pattabiraman, Vinod Grover, Ben Zorn

PLDI 2006: DieHard: probabilistic memory safety for unsafe languages
Emery Berger, Ben Zorn

PLDI 2006: Cache-conscious coallocation of hot data streams
Trishul Chilimbi and Ran Shaham