CppCon 2019: Emery Berger “Mesh: Automatically Compacting Your C++ Application's Memory”

Channel:CppCon · Length:36:09 · Published:2019-10-11 · Views:14729

Watch on YouTube

Summary

Emery Berger's CppCon 2019 talk introducing Mesh, a drop-in malloc replacement that compacts memory in unmodified C and C++ programs. It tackles fragmentation by merging pages without changing pointers.

Why HN recommends it

HN recommends Berger's talks as fascinating and cites Mesh as mind-blowing memory allocator work.

the weird and wonderful work of Emery Berger et al with their “Mesh” malloc implementation, which blows my mind — HN, 2023

C, C++, Rust, Go & systems languages · Software performance & optimization

Subtitles (excerpt)

all right so first I always like to start off with a story so the story today is a story some of you may have heard so this is Man of La Mancha he had an impossible dream this is Don Quixote his impossible dream was to reconquer all of Spain really for chivalry right so bring back chivalry to make Spain great again so so this is a story of a slightly different version of Don Quixote he's the Malik of La Mancha and and his goal is to allocate all of Spain alright so he's gonna start allocating little bits and pieces of Spain is the normal way right bum pointer so just start conquering Spain from from left to right top down right so he just keeps on going Malik Malik Malik everything's awesome and you know sometimes though there are some setbacks right so you fill this point up some of you familiar with the with the story may know that he confused windmills for Giants and so the giant comes back and frees a piece all right so that's too bad so now he's like well I'm gonna conquer a bunch of Spain right I'm gonna get a big swath up for chivalry and so here's this big swath here's the problem what do I do with this swath right it doesn't fit anywhere now in a world where you could do something sort of Tetris style you could

On Hacker News

You’d need cooperation between your malloc implementation and the application code. It’s possible, but tricky. If your malloc returned a pointer to a pointer, and promised to keep the first level pointer up to date, and was able to lock your application whenever it moved things around, it could work. Someone else already mentioned, but garbage collected languages do actually do this. Because they… — samwho, 2023-05
"Performance matters" by Emery Berger on StrangeLoop'19 is a great talk - [LINK] Also, rest of his talks are also fascinating: - [VIDEO] - [LINK] — divan, 2019-12
According to the cppcon talk about Mesh [1] (an allocator that implement compaction for C++ programs), the overhead can be massive too (17% overhead measured on firefox, 50% on redis!) [1] [VIDEO] — atom3, 2021-11

Related videos