what keeps a COM object alive?

finalpatch fengli at gmail.com
Wed Jun 12 08:55:53 PDT 2013


"Richard Webb" <webby at beardmouse.org.uk> writes:

> On Wednesday, 12 June 2013 at 14:41:05 UTC, finalpatch wrote:
>
>>
>> This feels even more cumbersome than in C++ because in C++ we can
>> simply
>> delete this in the Release() method, there's no need to store a
>> reference in a global place.
>>
>
>
> Juno does this by allocating the object on the non-gc heap, adding it
> as a GC root, and then deleting it when the refcount reaches 0.
> It works ok, though I think the current implementation has some
> issues.

I was reading the CHello sample that ships with DMD. I don't see
anything that can prevent the GC from killing a running object, this
makes me wonder whether it is actually a correct sample. 

-- 
finalpatch


More information about the Digitalmars-d-learn mailing list