Boost logo

Boost Users :

From: Paul Giaccone (paulg_at_[hidden])
Date: 2007-04-19 12:26:18


Paul Giaccone wrote:

>Michael Fawcett wrote:
>
>
>>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.
>>
>>
>It looks like I might have been doing something else wrong after all
>that would cause a memory leak - copying pointers to arrays in a copy
>constructor instead of allocating memory and then copying the array
>elements.
>
>
>
Hm, that made no difference... Maya is still hanging with a segmentation
fault when delete() is being called (not by me, incidentally) after 24
out of 48 frames have been processed, as if it is deciding it doesn't
want the node after that length of time. It still works fine in Windows.


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