Subject: Re: [boost] [thread] Memory leak in Boost.Thread?
From: Denis Arnaud (denis.arnaud_boost_at_[hidden])
Date: 2010-10-03 07:16:48
> Date: Wed, 29 Sep 2010 15:17:40 -0400
> From: Frank Mori Hess <frank.hess_at_[hidden]>
> > > a Fedora user has reported a potential memory leak in Boost.Thread (see
> > > https://bugzilla.redhat.com/show_bug.cgi?id=627875 for details),
> > > with Valgrind in (at least) versions 1.41.0 and 1.44.0.
> > Apparently, as per https://bugzilla.redhat.com/show_bug.cgi?id=627875#c7,
> > it seems there is a bug in Boost Thread.
> > As I'm not a specialist in that area, I prefer to hand it over to more
> > savvy developers on the list. Do not hesitate to answer directly on
> > Bugzilla.
> As far as I can tell, the "fix" for this "bug" is to insure some per-thread
> memory is freed just before the entire program exits? The only point to
> doing that would be to quiet valgrind.
Maybe the reason posix threads don't invoke their per-thread data
> destructors is that it is pointless? I mean to say they don't invoke when
> the thread is killed due to the
> main thread exiting.
What do you think of Bart's suggestion in
https://bugzilla.redhat.com/show_bug.cgi?id=627875#c9 (i.e., adding "some
comments in the two source files
that even when an application exit()s normally it is possible that the
destructor is not invoked, together with the a reference to the POSIX specs
that explain this behavior, e.g.,
I've looked into the Gmane archive of the Boost developer list (
and that issue has been raised several times during (at least) the last six
years, with sometimes the same recommendation: to add some comments in the
source code. For instance,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk