Hi J-S,

Jean-Sébastien Guay wrote:
I am currently chasing memory leaks in our application, which is like a modeling tool where the user will open/work on/save/close data files multiple times during the same application run. What we are seeing is that when a file is closed, not all memory related to scene graph objects seems to be released.

First question:

I enabled the DEBUG_OBJECT_ALLOCATION_DESTRUCTION define in src/osg/Referenced.cpp, and have set up a small test which just creates two viewers one after the other in different scopes. Pseudocode:
[...]

What I see is this (all in debug):

Breakpoint #1     :    8 Referenced objects,  12MB
First viewer run  : ~505 Referenced objects, 266MB
Breakpoint #2     :  247 Referenced objects, 167MB
Second viewer run : ~505 Referenced objects, 266MB
Breakpoint #3     :  247 Referenced objects, 172MB

But then, when I pass breakpoint #3, all the destructors for those Referenced objects are called, and at the end no objects are left allocated. (I can see that the final number of objects is 0)

Other than seeing that there are no real "leaks" per se, my question about that is, what are those objects that are staying alive outside the scopes?
You could perhaps hack on the DEBUG_OBJECT_ALLOCATION_DESTRUCTION code in src/osg/Referenced.cpp a bit and, for instances that derive from Object, print their libraryName()+className() as they get created/destoyed instead of just the total number of objects. Maybe that can give you some information on which objects stay around.

Paul

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to