On Phobos GC hunt

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 9 03:01:30 PDT 2014


Am Tue, 07 Oct 2014 15:57:58 +0000
schrieb "Dmitry Olshansky" <dmitry.olsh at gmail.com>:

> I made a proposal to quantatively measure and tabulate all GC 
> allocations in Phobos before coming up with solutions to "@nogc 
> Phobos".
> 
> After approving node from Andrei I've come up with a piece of 
> automation to extract this data and post it on wiki.
> 
> So here is the exhustive list of everything calling into GC in 
> Phobos (-vgc compiler flag):
> 
> http://wiki.dlang.org/Stuff_in_Phobos_That_Generates_Garbage
> 
> Including source links, a wild guess at function's name and the 
> compiler's warning message for potential GC call.
> 
> As far as data goes this is about as good as we can get, the next 
> phase is labeling this stuff with potential solution(s). Again 
> doing all by hand is tedious and hardly useful.
> 
> Instead we need to observe patterns and label it automatically 
> until the non-trivial subset remains. So everybody, please take 
> time and identify simple patterns and post back your ideas on 
> solution(s).
> 
> So far I see the most frequent cases:
> - `new SomeException` - switch to RC exceptions
> - AA access - ??? (use user-defined AA type as parameter?)
> - array concat - ???
> - closure - ???
> 
> 
> 
> ---
> Dmitry Olshansky

Another observation: idup/dup are not reported by -vgc (This is correct
behavior. @nogc detects these as normal functions without @nogc
attribute and complains. -vgc does not report calls to non- at nogc
functions).
However, idup/dup might be common and it might make sense to grep for
them manually?


More information about the Digitalmars-d mailing list