[osg-users] OpenThread leak ?

Adam Coates acoates at stanford.edu
Tue Sep 25 13:36:26 PDT 2007

Makes sense to me -- but at the least this is now a "documented" issue
in case others are curious and need to solve it for their own reasons.


On 9/25/07, Robert Osfield <robert.osfield at gmail.com> wrote:
> On 9/25/07, Adam Coates <acoates at stanford.edu> wrote:
> > I looked into this a tad more;  it looks like it is indeed caused by
> > the thread not being detached.  I added the line:
> >
> >     pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
> >
> > before the thread creation so that the thread will clean up
> > automatically.  This eliminates the memory leak.  This is a bad hack,
> > since it will break the join() and detach() functions.  However,
> > before I tried this, I tried calling join() and detach() on the Thread
> > object, but that only leads to a segfault (not sure why yet).
> Just a quick comment, in early days of OpenThreads/OSG development we
> tried out join() but found problems with it and certain platforms.  I
> can't recall which platforms, nor which combinations of usage, nor the
> actual symptoms exhibited - its was around 6 years ago.
> As for a small memory leak on exit from an app, well unix will clean
> this up for you anyway on exit from the app, so while it'd be good
> practice to solve it, its not going to make any significance to any
> application built on the OSG.  Given how many other tasks I have on my
> plate I'll leave this lower priority issue to others to chase up if
> they fancy :-)
> Robert.
> Robert.
> _______________________________________________
> 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