Analysis of D GC

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 20 00:47:13 PDT 2017


On Monday, 19 June 2017 at 23:52:16 UTC, Vladimir Panteleev wrote:
> On Monday, 19 June 2017 at 22:35:42 UTC, Dmitry Olshansky wrote:
>> My take on D's GC problem, also spoiler - I'm going to build a 
>> new one soonish.
>
> Looks like I'm not the only one itching to have a go at D's GC 
> :) This will very likely be my DConf 2018 project. However, I 
> have slightly different plans:

I see no problem in eventually uniting our efforts.

>
> - The GC should be usable as a library (mainly to facilitate 
> testing).
> - Support for all platforms D already supports from the start.
> - Use design-by-introspection when applicable and 
> design-by-contract elsewhere to split the design into modular 
> components.

Nice. A pool could have many different structures, the collector 
could then introspect on that. Sadly this almost doubles the 
effort so I will not go there.

> - Make the GC configurable (using policies) and swappable at 
> runtime. (No need to get clever, just treat previous 
> implementation's pools as opaque void[]).
> - Support concurrency on Windows via anonymous memory-mapped 
> files.

Yeah I recall Rainer and myself discussing this approach, it had 
some downside such as you need to remap each pool individually. 
Still doable.

> - Support generational collection using write barriers 
> implemented through memory protection.

Super slow sadly. That being said I belive D is just fine without 
generational GC. The generational hypothesis just doesn't hold to 
the extent it holds in say Java. My hypothesis is that most 
performance minded applications already allocate temporaries 
using region allocator of sorts (or using C heap).

> - Integrate existing GC work - don't reinvent the wheel.
> - More, much more debugging facilities! Integrate Diamond and 
> Valgrind interoperability.

  I could use help on thus one.

> - Gray-marking and compacting.
> - Still need to look at immix.
>
> I have some past work that I'd like to integrate (an 
> experimental generational GC I wrote like 9 years ago for D1, 
> Diamond, and Valgrind integration I have in a fork somewhere.)

---
Dmitry Olshansky



More information about the Digitalmars-d mailing list