3 ms·
The D language is currently heading towards deterministic and safe memory management, making it possible to avoid the GC overall, hence further work on GC impro
by dawg 9y ago
The D language is currently heading towards deterministic and safe memory management, making it possible to avoid the GC overall, hence further work on GC improvements was deprioritized.
http://dlang.org/blog/2017/06/16/life-in-the-fast-lane/ http://dlang.org/blog/2017/06/16/life-in-the-fast-lane/
The problems are known and indeed a full rewrite on this ancient GC would be in order. Since D 2.072.0 it's possible to link and use different GCs, so a faster one could be written as an external library which would be a very welcome effort.
https://dlang.org/changelog/2.072.0.html#gc-runtimeswitch-added https://dlang.org/changelog/2.072.0.html#gc-runtimeswitch-ad...
I'd be interested in experimenting with a Connectivity-Based GC (https://www.cs.purdue.edu/homes/hosking/690M/cbgc.pdf https://www.cs.purdue.edu/homes/hosking/690M/cbgc.pdf), leveraging type information to do partial collections.
Write barriers come with a performance penalty (~3-5%) that we don't want to impose on people using deterministic memory management, but most GCs capable of performing partial collections, e.g. generational GCs, do require write barriers, Connectivity-Based GCs do not.
For the time being the pragmatic advise is to replace major sources of GC allocations with deterministic memory management when the GC heap grows too big (~1GB) and performance becomes a problem.
So far this hasn't prevented various people from writing extremely fast D programs.
- deleted 9y ago[deleted]
- amelius 9y ago> The D language is currently heading towards deterministic and safe memory management, making it possible to avoid the GC overall Is this really true?
- mhh__ 9y agoYes, but the D community isn't structured enough to have such a specific goal. The main effort that I can think of is dip1008, which aims to add reference counted exceptions (Thus eliminating one of the few truly difficult things to get around, e.g. @nogc exceptions require user cooperation else memory gets leaked)
- deleted 9y ago[deleted]
- WalterBright 9y agoYes. I gave a presentation on this at DConf 2017. http://dconf.org/2017/talks/bright.html http://dconf.org/2017/talks/bright.html
- amelius 9y agoBut is it really possible to completely avoid the GC? I'm thinking of memory blocks with cyclic references, and stuff like that.
- WalterBright 9y agoWrite barriers are cost effective with a language that makes high use of heap storage allocation, like Java. It makes a lot less sense for D, because D uses a lot of stack allocation and embedded instances instead.
- rbehrends 9y agoWrite barriers (or related techniques) are also important for incremental garbage collection.