RCArray is unsafe

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 4 02:03:12 PST 2015


On Wednesday, 4 March 2015 at 09:06:01 UTC, Walter Bright wrote:
> On 3/4/2015 12:13 AM, deadalnix wrote:
>> The #1 argument for DIP25 compared to alternative proposal was 
>> its simplicity. I
>> assume at this point that we have empirical evidence that this 
>> is NOT the case.
>
> The complexity of a free list doesn't remotely compare to that 
> of adding an ownership system.
>

A free list does not work as the data can be live. You cannot 
reuse it to maintain the free list. You need to maintain metadata 
about allocation in another structure.

Also you cannot free anything until all the refcount are to 0. 
This RC system will only cut it for short lived entities.


More information about the Digitalmars-d mailing list