Heap Layers: An Extensible Memory Allocation Infrastructure
Clone or download


Heap Layers: An Extensible Memory Allocation Infrastructure

Copyright (C) 2000 - 2018 by Emery Berger

Please read COPYING for licensing information.

Heap Layers is distributed under the terms of the GNU General Public License.

Commercial licenses are also available.

Please contact Emery Berger (emery@cs.umass.edu) for more details.


Heap Layers provides a flexible 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 has been used successfully to build a number of high-performance allocators, including Hoard and DieHard.

Using Heap Layers

For an introduction to Heap Layers, read the article Policy-Based Memory Allocation, by Andrei Alexandrescu and Emery Berger. It's a good overview.

Heap Layers contains a number of ready-made heap components that can be plugged together with minimal effort, and the result is often faster than hand-built allocators. The PLDI 2001 paper Composing High-Performance Memory Allocators has plenty of examples.


Heap Layers can substantially outperform its only real competitor, the Vmalloc package from AT&T. The OOPSLA 2002 paper 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.