Hi David,

On 30/08/11 14:37 , David Benoit wrote:
> Sorry.  I was not clear about exactly what my problem was.  It was not a 
> memory leak.
> I was running out of memory because the OSG garbage collector was not freeing 
> memory
> right away.  It would eventually free memory if I waited long enough, but I 
> needed a
> way to force it to free the memory immediately.
> 
> In my code, if I added some sleep() calls, I could see (on Ubuntu) memory 
> usage rise
> and fall as expected.  If I removed those sleep() calls, but left everything 
> else the
> same, memory usage would not fall and I would run out of memory.
> 
> My solution was to use DeleteHandler::flush() after removeChild() as well as 
> making
> sure my object have been rendered to the screen.  (I suspect the refCount 
> won't be zero
> until after an object has actually been drawn, but I didn't verify this.)
> 
> I would be interested to hear from anyone else who has had to worry about the 
> details
> of the garbage collector.

There is no 'OSG garbage collector' for objects in the scene graph.

OSG uses reference counting and objects are released when no one is using them 
anymore. If
you see a delay between the time that your code releases an object and the time 
that the
object gets deleted it is because someone else (e.g. the draw thread) is still 
using it.

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

Reply via email to