[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.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of n.torrey.pines@gmail.com
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.
I can confirm that memory is not freed, however I don't think it's a leak. If you make 10 threads or 1 thread, it's the same amount of memory that goes without deallocation. Sohail
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.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of n.torrey.pines@gmail.com
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.
You'd have to find the source of that specific message to be sure. I think its to do with some singleton used in the Windows version of Boost.Thread.
n.torrey.pines@gmail.com wrote:
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?
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