Mesh: a new approach to memory compaction for C/C++

Emery Berger emery at
Sun Sep 22 16:15:08 UTC 2019

On Wednesday, 18 September 2019 at 09:31:07 UTC, Gregor Mückl 
> On Tuesday, 17 September 2019 at 11:42:51 UTC, Per Nordlöw 
> wrote:
>> strangeloop talk here:
>> and github repo here:
>> Sounds to me like making D's GC precise by default to enable 
>> memory compaction is worth pursuing.
> I'm am thinking about the implications for debugging. Mapping 
> the same page to two virtual memory addresses on the heap 
> creates weird situations where writing over the bounds of one 
> object doesn't trash allocations with nearby memory addresses, 
> but can affect seemingly far away allocations that ended up 
> randomly aliased to the same page. Even worse, Mesh randomizes 
> allocations within pages to get more opportunities to alias 
> pages. This means that some heap-smashing bug will likely 
> present itself differently on each run. Have fun finding the 
> root cause of that :/.

You can always seed the random number generator with a fixed 
value to get reproducible runs.

More interestingly, it's also possible to exploit an 
Exterminator-like approach  (see to 
automatically find the source of such bugs! This is specifically 
enabled by randomization. We implemented Exterminator for a 
previous randomizing allocator (DieHard: code here, including 
Exterminator --, and 
there's no technical barrier to doing the same for Mesh.

-- emery (Mesh co-author)

More information about the Digitalmars-d mailing list