Hi Jean Sebastien, My implementation just add a call in constructor and destructor of osg::Referenced, and then in a map increment or decrement from the type.
It's really simple but was helpful. I will see how Robert answer, and we will adjust how to put our stuff and mixing them in osg. Cheers, Cedric On Mon, 2010-08-02 at 09:32 -0400, Jean-Sébastien Guay wrote: > Hi Cedric, > > > I have work on a small tool to detect how a program evolve during time, > > It tracks the numer of instance of each object inherited from > > osg::Referenced. I use this to detect 'leak' but release when quitting > > the program so not really a leak but to detect consumption of too much > > memory during runtime. > > The tool to works need modification in osg::Referenced. because there is > > already a mecanism to set a custom DeleteHandler, I thought we could do > > the same to intercept instanciation of osg::Referenced with a custom > > InstanceHandler ? > > A while ago I suggested a similar modification to osg::Referenced to be > able to register all instances of osg::Referenced created, and dump the > current state at a given time. > > http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/37589/focus=38000 > > http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/4682 > > I used this to find a runtime memory leak caused by a circular reference > in osgShadow::StandardShadowMap and related classes. The ShadowTechnique > had a ref_ptr to the scene camera, and indirectly (through the scene's > children eventually going to the ShadowedScene) the camera also had a > ref_ptr to the ShadowTechnique, so both their ref counts always stayed > >= 1 and the whole scene was never deleted. This was a big memory leak > for us since our software needs to be able to load many scenarios during > its runtime, and we expected the whole scene to be deleted when a new > scenario was loaded. > > However, Robert asked that I wire in support to enable/disable my > modifications in CMake, which made sense, but I never got around to > doing it. :-( Perhaps if your modifications get accepted I'd be able to > adapt what I had done and we'd get the best of both worlds. > > Do your changes also intercept calls to ref(), unref() and > unref_nodelete()? That was useful to me in order to find out who was > keeping refs to my objects and not releasing them. > > Good work, > > J-S -- Provide OpenGL, WebGL and OpenSceneGraph services +33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.net http://www.plopbyte.net
signature.asc
Description: This is a digitally signed message part
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org