[osg-users] How to track down memory leaks?

Robert Osfield robert.osfield at gmail.com
Wed Jul 11 09:20:42 PDT 2018

HI Igor,

You don't provide enough information to know what might be causing the
increasing in memory so we can't provide any specific guidance.  In
general the OSG's memory management is pretty solid, there are areas
where data is cached either explicitly or implicitly due to
restrictions due to the GL memroy model.

In the osgDB::FileCache but this is only associated with loading and
reusing loaded models and is off by default so unless you have
specifically enabled this and loading adding to the scene graph then
removing from the scene graph.

Then there is the OpenGL side, to rendering with OpenGL you have to
create texture objects, buffer objects and display lists that are all
cached within OpenGL driver memory, when you delete the corresponding
scene graph objects these GL objects can't be deleted right away so
the OSG caches them and then flushes these caches during the next
frame.  It does like flush in a lazy way though, and will attempt to
reuse GL objects when you request new GL objects of the same size and
format of the cached GL  objects.   This reuse of cached and waiting
to be deleted GL objects really helps with performance for dynamic
scene graphs.

While this caching on the GL side can initially grow it's not a leak,
it's just delayed clean up and it should stabilize after a while.

Then there is bugs in your own program, or perhaps even issues with
how you are measuring the "leak".  We don't have your program in front
of us, we don't have your data, or any of your tests results so
basically can't really do anything more - you are the only with all
the tools in front of you.


More information about the osg-users mailing list