{"id":13423684,"url":"https://github.com/plasma-umass/Mesh","last_synced_at":"2025-03-15T17:32:08.510Z","repository":{"id":37286225,"uuid":"41697180","full_name":"plasma-umass/Mesh","owner":"plasma-umass","description":"A memory allocator that automatically reduces the memory footprint of C/C++ applications.","archived":false,"fork":false,"pushed_at":"2024-07-06T20:57:14.000Z","size":5962,"stargazers_count":1796,"open_issues_count":32,"forks_count":79,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-03-13T18:06:55.512Z","etag":null,"topics":["allocator","malloc-library","memory","memory-allocator","memory-management"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plasma-umass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/export_mesh.cmake","governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-31T19:52:51.000Z","updated_at":"2025-03-10T19:49:01.000Z","dependencies_parsed_at":"2024-01-31T01:02:49.073Z","dependency_job_id":"53c17887-1951-4777-bf2b-5f841df8258d","html_url":"https://github.com/plasma-umass/Mesh","commit_stats":{"total_commits":1083,"total_committers":13,"mean_commits":83.3076923076923,"dds":"0.13481071098799635","last_synced_commit":"ae77cdbf93925bd8390d2ad8379ef4d2a625e7bd"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasma-umass%2FMesh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasma-umass%2FMesh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasma-umass%2FMesh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plasma-umass%2FMesh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plasma-umass","download_url":"https://codeload.github.com/plasma-umass/Mesh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243767122,"owners_count":20344873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allocator","malloc-library","memory","memory-allocator","memory-management"],"created_at":"2024-07-31T00:00:40.607Z","updated_at":"2025-03-15T17:32:06.973Z","avatar_url":"https://github.com/plasma-umass.png","language":"C++","funding_links":[],"categories":["C++","Memory Allocation"],"sub_categories":[],"readme":"Mesh: Compacting Memory Management for C/C++\n============================================\n\nMesh is a drop in replacement for\n[malloc(3)](http://man7.org/linux/man-pages/man3/malloc.3.html)\nthat can transparently recover from memory fragmentation without any changes\nto application code.\n\nMesh is described in detail in a [paper (PDF)](https://github.com/plasma-umass/Mesh/raw/master/mesh-pldi19-powers.pdf) that appeared at PLDI 2019.\n\nOr watch this talk by Bobby Powers at Strange Loop:\n\n[![Compacting the Uncompactable](https://img.youtube.com/vi/c1UBJbfR-H0/0.jpg)](https://www.youtube.com/watch?v=c1UBJbfR-H0)\n\nMesh runs on Linux and macOS.  Windows is a work in progress.\n\nMesh uses [bazel](https://bazel.build/) as a build system, but wraps it in a Makefile, and has no runtime dependencies\nother than libc:\n\n```\n$ git clone https://github.com/plasma-umass/mesh\n$ cd mesh\n$ make; sudo make install\n# example: run git with mesh as its allocator:\n$ LD_PRELOAD=libmesh.so git status\n```\n\nPlease open an issue if you have questions (or issues)!\n\n\nBut will it blend?\n------------------\n\nIf you run a program linked against mesh (or with Mesh `LD_PRELOAD`ed), setting the variable `MALLOCSTATS=1` will instruct mesh to print a summary at exit:\n\n```\n$ MALLOCSTATS=1 ./bin/redis-server-mesh ./redis.conf\n25216:C 11 Mar 20:27:12.050 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo\n25216:C 11 Mar 20:27:12.050 # Redis version=4.0.2, bits=64, commit=dfe0d212, modified=0, pid=25216, just started\n25216:C 11 Mar 20:27:12.050 # Configuration loaded\n[...]\n^C25216:signal-handler (1583983641) Received SIGINT scheduling shutdown...\n25216:M 11 Mar 20:27:21.945 # User requested shutdown...\n25216:M 11 Mar 20:27:21.945 * Removing the pid file.\n25216:M 11 Mar 20:27:21.945 * Removing the unix socket file.\n25216:M 11 Mar 20:27:21.945 # Redis is now ready to exit, bye bye...\nMESH COUNT:         25918\nMeshed MB (total):  101.2\nMeshed pages HWM:   25918\nMeshed MB HWM:      101.2\nMH Alloc Count:     56775\nMH Free  Count:     17\nMH High Water Mark: 82687\n```\n\nNot all workloads experience fragmentation, so its possible that Mesh will have a small 'Meshed MB (total)' number!\n\n\nImplementation Overview\n-----------------------\n\nMesh is built on [Heap Layers](http://heaplayers.org/), an\ninfrastructure for building high performance memory allocators in C++\n(see the\n[paper](https://people.cs.umass.edu/~emery/pubs/berger-pldi2001.pdf)\nfor details.)\n\nThe entry point of the library is [`libmesh.cc`](src/libmesh.cc).\nThis file is where `malloc`, `free` and the instantiations of the\nHeap used for allocating program memory lives.\n\n\nDEFINITIONS\n-----------\n\n- **Page**: The smallest block of memory managed by the operating\n  system, 4Kb on most architectures.  Memory given to the allocator by\n  the operating system is always in multiples of the page size, and\n  aligned to the page size.\n- **Span**: A contiguous run of 1 or more pages.  It is often larger\n  than the page size to account for large allocations and amortize the\n  cost of heap metadata.\n- **Arena**: A contiguous range of virtual address space we allocate\n  out of.  All allocations returned by\n  [`malloc(3)`](http://man7.org/linux/man-pages/man3/malloc.3.html)\n  reside within the arena.\n- [**GlobalHeap**](src/global_heap.h): The global heap carves out the\n  Arena into Spans and performs meshing.\n- [**MiniHeap**](src/mini_heap.h): Metadata for a Span -- at any time\n  a live Span has a single MiniHeap owner.  For small objects,\n  MiniHeaps have a bitmap to track whether an allocation is live or\n  freed.\n- [**ThreadLocalHeap**](src/thread_local_heap.h): A collections of\n  MiniHeaps and a ShuffleVector so that most allocations and\n  `free(3)`s can be fast and lock-free.\n- [**ShuffleVector**](src/shuffle_vector.h): A novel data structure\n  that enables randomized allocation with bump-pointer-like speed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasma-umass%2FMesh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplasma-umass%2FMesh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplasma-umass%2FMesh/lists"}