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

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Sat May 10 22:16:25 PDT 2014


Am 11.05.2014 03:31, schrieb "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>":
> 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.
>

This is what java.lang.ref.ReferenceQueue are for in Java, but one needs 
to be a GC expert on how to use it, otherwise it will hinder the GCs work.

--
Paulo



More information about the Digitalmars-d mailing list