dglenn wrote:
> 
> Memory handling has always been my worse subject in CS!
> 


Not my best one either...  :( 

@ 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.

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?
'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
}


I don't know what to think about it... Could it cause a custom class not to be 
handled as it should be?...

And another point : what if an update callback is still running when the object 
is dereferenced? Will it be dereferenced too?...

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27977#27977





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to