RCArray is unsafe

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 3 13:51:50 PST 2015


On Tuesday, 3 March 2015 at 18:49:43 UTC, Andrei Alexandrescu 
wrote:
> On 3/3/15 10:22 AM, Zach the Mystic wrote:
>> On Tuesday, 3 March 2015 at 17:40:59 UTC, Marc Schütz wrote:
>>> All instances need to carry a pointer to refcount anyway, so 
>>> the
>>> freelist could just be stored next to the refcount. The idea 
>>> of
>>> creating that list, however, is more worrying, because it 
>>> again
>>> involves allocations. It can get arbitrarily long.
>>
>> If the last RcType is a global, will the list ever get freed 
>> at all?
>
> No. Making a global variable of a reference counted type would 
> be poor design.
>
>
> Andrei

Considering glopbal here means thread local, I think it does make 
sense to use global for various forms of cache.


More information about the Digitalmars-d mailing list