|
Boost Users : |
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2007-04-19 11:06:17
On 4/19/07, Paul Giaccone <paulg_at_[hidden]> wrote:
>
> If I've understood correctly, this means that any memory allocated on
> the heap in MyNode must be done using bare pointers rather than smart
> pointers, so that Maya can delete it when it wants, not when the smart
> pointers say the memory can be released. MyNode and any objects that it
> allocates on the heap still need to have destructors to deallocate their
> contents, but it is up to Maya when the destructor for MyNode is called.
I don't think this is the case. MyNode's destructor will get called
when Maya determines it's time to delete it, and any smart_ptr member
variables will decrement their reference count. That's the ideal
state of affairs, since it works as designed. The only difference is
that MyNode pointers are created by a create function, and Maya cleans
them up. You cannot attempt to manage MyNode pointers, since Maya
determines their lifetime, however, you can (and should) manage
anything not managed by Maya.
--Michael Fawcett
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net