Mesh is a drop in replacement for malloc(3) that compacts the heap of C and C++ programs without rewriting application pointers.
Mesh is built on Heap Layers, an infrastructure for building high performance memory allocators in C++ (see paper for details.
The entry point of the library is libmesh.cc
.
This file is where malloc
, free
and the instantiations of the
Heap used for allocating program memory lives.
- Page: The smallest block of memory managed by the operating system, 4Kb on most architectures. Memory given to the allocator by the operating system is always in multiples of the page size, and aligned to the page size.
- Span: The size of memory managed by Mesh -- currently 128 Kb. It is larger than the page size to amortize the cost of heap metadata.
- MiniHeap: A bitmap, metadata and associated Span for a particular size of objects (size class).
- MeshingHeap: A collection of miniheaps for a particular size class, including a current MiniHeap that we are allocating out of.
$ git submodule update --init; ./configure; make