when is the object destuctor called?
kris
foo at bar.com
Mon May 22 16:09:55 PDT 2006
Tom S wrote:
> Johan Granberg wrote:
>
>> Tom S wrote:
>>
>>> Derek Parnell wrote:
>>>
>>>> I use the same technique. The idea that the only resource a
>>>> ctor/dtor manages is RAM is plainly short-sighted.
>>
>> Agrees.
>>
>>> As for the texture example, they should be freed by some sort of a
>>> manager anyway - they have to be released before the rendering device
>>> anyway...
>>
>> Ok I think I get it. The destructors should only bee used when objects
>> is deleted manually. right?
>
>
> That's what I'm doing. Otherwise dtors are just unreliable...
You might take a look at what Ares does in this regard? It allows one to
intercept object collection, and lets you know whether the cleanup is of
deterministic or "unspecified" nature. Invoking a dtor is only
considered reliable in the deterministic case, so Ares allows one to
trap and then optionally avoid dtor calls for that other case. One might
use this mechanism to detect resource-leaks also.
More information about the Digitalmars-d
mailing list