Mesh: Automatically Compacting Your C++ Application's Memory
summary
A plug-in malloc replacement that compacts C/C++ heaps without source changes or pointer-fixing, enabled by an environment variable, claims provable fragmentation reduction using user-space virtual memory remapping. It uses per-page randomized allocation with a shuffle vector randomized offsets and a simple pairing algorithm to find mashable pages, cutting compaction work (5x less copying) and matching allocator speed while shrinking Firefox memory by ~16% and Redis by ~39%. plug-in malloc replacement
AI-written summary · about
chapters (22)
- 0:00Introduction to fragmentation
- 3:58Why compaction is hard
- 8:34Mesh without code changes
- 10:00Virtual relocation trick
- 13:10Randomization in mesh
- 16:37Finding meshable pages
- 20:07Efficient mesh candidate search
- 21:10Implementation with key players
- 22:54Performance results
- 23:36Other projects and tools
- 24:40Q&A: Handling page faults
- 25:23Q&A: OS overhead and page merging
- 26:26Q&A: Determining page occupancy
- 27:31Q&A: Windows compatibility
- 28:13Q&A: Windows resources
- 29:37Q&A: Virtual address space
- 30:40Q&A: Randomization and locality
- 31:23Q&A: Latency spikes
- 32:47Q&A: Triggering compaction
- 33:49Q&A: Disabling async operations
- 34:11Q&A: Windows memory mapping
- 35:15Q&A: Competing projects
related talks
19mStarMalloc: Verifying a Modern, Hardened Memory Allocator
37mHeap Layout Optimisation for Exploitation
18mMohabi: Disaggregating and Sandboxing the Firefox JavaScript Engine
08mChatGPT, Make a Secure Malloc for me
30mMicro-Virtualization Memory Tracing to Detect and Prevent Spraying Attacks
30mRestricted Address Spaces for Container Security
19mCoSMIX: A Compiler-based System for Secure Memory Instrumentation and Execution in Enclaves
01h 06mmemory-safe C++
