[osg-users] osg-users Digest, Vol 34, Issue 32

Robert Osfield robert.osfield at gmail.com
Sat Jul 21 02:26:13 PDT 2007


HI Lilinx,

The difference in DrawThreadPerContext and
CullThreadPerCameraDrawThreadPerContext is that they use an
osg::DeleteHandler to cache the last two frames worth of deleted
objects to avoid issues with objects being deleted which others
objects have handles to them.  This caching is flushed on each frame
to get rid of objects older than 2 frames.

In 2.0 during clean up more objects than usually get placed in the
DeleteHandler and aren't flushed explicitly, but flushed when the
DeleteHandler goes out of scope.  A problem here can arise in the if
say osgUtil objects are in the DeleteHandler waiting to be deleted and
the osgUtil library gets unloaded then a call to delete these objects
will be undefined.  This may be where the memory leak is reported, or
perhaps its simply the the memory detector is make its decision about
what is a memory leak too early in clean up - this has been a known
issue under VS for a long while.

Since 2.0 I have clean up the way that the DeleteHandler is used on
exit, so that when osgViewer unloaded its automatically flushes the
DeleteHandler and switches off its caching so that all objects delete
right away.   I don't know if this will affect the memory leak
reporting though, as VS' memory leak detection is a bit flaky.

Robert.





On 7/21/07, lilinx at 21cn.com <lilinx at 21cn.com> wrote:
> osg-users-requesthi,all
>
> memory leak problem
>
> I work on windows xp, 2cpu(Pentium (R) D CPU 2.8GHz), Nvida 7300GT grahpic card, osg2.0 compile with vc71.
> I test :
>      1. osgviewer.exe cow.osg --SingleThreaded  ,                              no memory leak
>       2. osgviewer.exe cow.osg --CullDrawThreadPerContext  ,                    no memory leak
>      3. osgviewer.exe cow.osg --DrawThreadPerContext  ,                        has memory leak
>      4. osgviewer.exe cow.osg --CullThreadPerCameraDrawThreadPerContext  ,     has memory leak
>           5. osgviewer.exe cow.osg                                                    ,     has memory leak  (auto select DrawThreadPerContext)
>
> I test on other single cpu computer, the differences is "osgviewer.exe cow.osg" no memory leak(auto select SingleThreaded).
>
> lilinx
>         lilinx at 21cn.com
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


More information about the osg-users mailing list