A memory allocator that automatically reduces the memory footprint of C/C++ applications.
A memory allocator that automatically reduces the memory footprint of C/C++ applications.
Mesh is a drop in replacement for malloc(3) that can transparently recover from memory fragmentation without any changes to application code.
Mesh is described in detail in a paper (PDF) that appeared at PLDI 2019.
Or watch this talk by Bobby Powers at Strange Loop: Mesh runs on Linux and macOS. Windows is a work in progress.
Mesh uses bazel as a build system, but wraps it in a Makefile, and has no runtime dependencies other than libc:
$ git clone https://github.com/plasma-umass/mesh
$ cd mesh
$ make; sudo make install
# example: run git with mesh as its allocator:
$ LD_PRELOAD=libmesh.so git status
Please open an issue if you have questions (or issues)!
If you run a program linked against mesh (or with Mesh LD_PRELOADed), setting the variable MALLOCSTATS=1 will instruct mesh to print a summary at exit:
…
Not all workloads experience fragmentation, so its possible that Mesh will have a small 'Meshed MB (total)' number!
Mesh is built on Heap Layers, an infrastructure for building high performance memory allocators in C++ (see the 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.
malloc(3)
reside within the arena.free(3)s can be fast and lock-free.No open issues yet, or sync has not completed.