CppCon 2019 has ended
Thursday, September 19 • 15:50 - 16:20
Mesh: Automatically Compacting Your C++ Application's Memory

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Programs written in C++ 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 C++ applications through compaction. A key challenge is that, unlike in garbage-collected environments, the addresses of allocated objects in 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. Mesh combines novel randomized algorithms with widely-supported virtual memory operations to provably reduce fragmentation, breaking long-established worst-case bounds on memory efficiency with high probability. Mesh generally matches the runtime performance of state-of-the art memory allocators while reducing memory consumption and eliminating pathological cases; in particular, Mesh reduces the memory of consumption of Firefox by 16% and Redis by 39%. There are efforts underway to incorporate Mesh's approach to eliminate fragmentation into existing allocators like tcmalloc and jemalloc; Mesh itself is available at https://github.com/plasma-umass/Mesh, and it can be used just by setting an environment variable.

avatar for Emery Berger

Emery Berger

Professor, University of Massachusetts Amherst
Emery Berger is a Professor of Computer Sciences at the University of Massachusetts Amherst, the flagship campus of the UMass system. Emery and his collaborators have built numerous widely adopted software systems including Hoard, a fast and scalable memory manager that accelerates... Read More →

Thursday September 19, 2019 15:50 - 16:20 MDT
Crest 3
  • Data Structures/Allocation
  • Level Intermediate, Advanced, Expert
  • Tags memory