radical ideas about GC and ARC : need to be time driven?

via Digitalmars-d digitalmars-d at puremagic.com
Sat May 10 18:31:18 PDT 2014


On Saturday, 10 May 2014 at 19:41:15 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> On Sat, May 10, 2014 at 09:16:54PM +0200, Xavier Bigand via 
> Digitalmars-d wrote:
> [...]
>> My concerns as Dlang user are :
>>  - Even if GC is the solution, how long I need suffer with
>>  destructor's issues (calls order)?
>
> Dtor calling order and GC are fundamentally incompatible. I 
> don't think
> this will ever be changed. The problem is, how do you guarantee 
> that the
> GC will only clean up garbage in the order of reference? You 
> can't do
> this without killing GC performance.

You can build a queue of root nodes in terms of parent-child 
ownership if you have parent backpointers. That allows you to 
separate scanning from releasing. You can then release when idle 
using a priority queue.

You can optimize scanning by tracing parent-pointers first then 
mark parent-children trees as live when hitting roots using extra 
datastructures and meta information. (assuming the tree has no 
external pointers below the root)

It has language and runtime consequences, but I doubt it will 
kill performance.

(I don't think it belongs in a system level language though)


More information about the Digitalmars-d mailing list