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
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to