More radical ideas about gc and reference counting

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 14:05:47 PDT 2014


On Wednesday, 30 April 2014 at 20:59:34 UTC, Andrei Alexandrescu 
wrote:
> On 4/30/14, 1:57 PM, Vladimir Panteleev wrote:
>> On Wednesday, 30 April 2014 at 20:45:57 UTC, Andrei 
>> Alexandrescu wrote:
>>>> An extreme one indeed, it would break a lot of my code. 
>>>> Every D project
>>>> I wrote that does networking manages memory using a class 
>>>> that resides
>>>> on the managed heap, but holds the actual wrapped data in 
>>>> the unmanaged
>>>> heap.
>>>
>>> So should I take it those classes all have destructors? --
>>
>> One class, many instances (one for every chunk of data sent or 
>> received).
>
> The question is, how comfortable are you with today's reality 
> that some of those instances may be never destroyed? -- Andrei

I'm fine with it. The proxy objects are purposefully as small as 
possible, to make false references (and thus, memory leaks) 
unlikely, even on 32 bits. If I was concerned with it, I'd have 
switched to reference counting as soon as it was possible.


More information about the Digitalmars-d mailing list