Reference counted containers prototype

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 27 07:06:26 PST 2011


On 12/27/11 5:43 AM, deadalnix wrote:
>> BTW, the plan is to have the same thread that constructed objects to
>> call their destructors; each thread would have a worklist of garbage
>> objects to destroy. The list can be reduced during calls to allocation
>> functions within each thread, and of course when the thread terminates.
>>
>>
>> Andrei
>
> This is nice for thread local data, but does it make sense for
> immuables/shared ?

Yes - when the GC reaps objects, they are past their useful lifetime so 
their qualifiers are gone.

> I'm not sure this design is secure regrading GC. What happen if the
> destructor of the RefCounted is called, (and will call dispose) and then
> the payload is destructed. We have a risk of double destruction.

I'm not sure I understand the scenario.


Andrei


More information about the Digitalmars-d mailing list