Ku Krapox wrote:
@ Paul : I've read your QSG, and found lots of useful information, thanks 
again! In particular I've learnt by heart the part on memory management. :P
But the problem is, I'm doing everything right... All my objects are now in 
ref_ptr and I still have memory leaks.

So, you're clearing a ref_ptr, and stepping through it in the debugger, and you're watching the reference count go to zero, but delete isn't being called? Please post a reproducer code that shows this behavior.

I had an idea : might inheritance interfere with the osg::Referenced system? I 
mean, if I create my own class derived from PAT, then put it in a ref_ptr, will 
it be handled correctly?

Any class derived from Referenced will work with OSG's memory management system.

'cause I've found out the following behaviour :


class CustomPAT : public osg::PositionAttitudeTransform {...}

int main()
{
PositionAttitudeTransform* myPAT1 = new PositionAttitudeTransform();
delete myPAT1; // Compilation error -> normal

CustomPAT* myPAT2 = new CustomPAT();
delete myPAT2; // Compilation OK !!! -> shouldn't be
}

Looks like you failed to declare your destructor protected.

--
  -Paul Martz      Skew Matrix Software
                   http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to