Mesh: automatically compacting memory for C/C++ applications
Emery D. Berger · UPCommons institutional repository (Universitat Politècnica de Catalunya) · 2020
Programs written in C and C++ — and languages implemented in C, like Python and Ruby — can suffer from serious memory fragmentation, leading to low utilization of memory, degraded performance, and application failure due to memory exhaustion. This talk introduces Mesh, a plug-in replacement for malloc that, for the first time, eliminates fragmentation in unmodified applications through compaction. A key challenge is that, unlike in garbage-collected environments, the addresses of allocated objects in C/C++ are directly exposed to programmers, and applications may do things like stash addresses in integers, and store flags in the low bits of aligned addresses. This hostile environment makes it impossible to safely relocate objects, as the runtime cannot precisely locate and update pointers.