[boost-thread] memory leak (according to Boost.Test)

This little program, compiled on VC++ 8.0 leaks memory, apparently. #define BOOST_AUTO_TEST_MAIN #include <boost/test/auto_unit_test.hpp> #include <boost/thread/thread.hpp> void f() {} BOOST_AUTO_TEST_CASE(threads_leak) { boost::thread thrd(&f); thrd.join(); } Output: Running 1 test case... *** No errors detected Detected memory leaks! Dumping objects -> {218} normal block at 0x00357458, 24 bytes long. Data: < 9 > 80 39 15 00 FF FF FF FF 00 00 00 00 00 00 00 00 {217} normal block at 0x00357398, 8 bytes long. Data: <Xt5 > 58 74 35 00 01 CD CD CD Object dump complete. Versions: Boost-1.33.1 VC++8.0 (debug mode) Windows XP extra lib: libboost_unit_test_framework-vc80-mt-gd.lib (not auto-linked) Can anyone using VC++ 8.0 and the release version of Boost confirm this? With Google, I found some past references to Boost.Thread leaking memory.

On 3/6/07, Sohail Somani <s.somani@fincad.com> wrote:
If you make 10 threads or 1 thread, it's the same amount of memory that goes without deallocation.
That appears to be correct. I wonder though why Boost.Thread needs to leak memory at all: was that a choice or an oversight? Those test messages look bad. If I were to distribute a test suite with my software, I'd have to tell the user to take it easy and make sure only 32 bytes got leaked.

n.torrey.pines@gmail.com wrote:
Choice. I was able to avoid the allocation in this specific case: http://boost.cvs.sourceforge.net/boost/boost/libs/thread/src/tss_hooks.cpp?revision=1.4&view=markup but in general, objects that need to have program lifetime cannot be deleted safely. Many industrial-grade leak checkers will not report such objects as leaks, because they aren't.
participants (3)
-
n.torrey.pines@gmail.com
-
Peter Dimov
-
Sohail Somani