[Boost.Threads] MSVC memory leak detected in boost v1.33.1
Hello, My questions are: 1) Is there any ETA for releasing a fix? 2) Otherwise, is there an recommended fix I can apply myself? Environment: * MSVC 8.0 * boost v1.33.1 It seems that it's a known issue that has been present for quite a while (at least since 1.30): "Perhaps this is the same leak reported by gast128 in the thread "Memory leak reported using threads library". A mutex is created in DLLMain -> on_process_enter -> init_threadmon_mutex. It seems that this mutex is never deleted and there is no comments that this is intentional. On Windows the size of the mutex is 8 bytes and it creates a CRITICAL_SECTION in its constructor - 24 bytes." I'm not concerned much by the size of the leak nor the semantics of whether it is truly a leak. My concern is that I'm receiving an alert from VS indicating "Detected memory leaks!" and regardless of how MS's detecting this, it's obviously not a good situation for me. Regards, Jason
Hi,
My Environment:
* MSVC 8.0
* boost v1.33.1
Using the example program below, I'm getting an assertion within boost's
thread class during a call to join. join() is being called twice: 1)
in main() 2) in ~Thread(). If I remove one of the calls to join() the
assertion goes away. Though this example's usage seems redundant such
behavior should be similar to the scenario of multiple threads waiting
on the same thread via join().
Help would be appreciated.
Regards,
Jason
// --------------------------------- BEGIN EXAMPLE PROGRAM
---------------------------
// Assertion failed: m_joinable, file
C:\...\boost\boost_1_33_1\libs\thread\build\..\src\thread.cpp, line 223
// Call Stack begins in the following code at the end of main() within
~Thread() in the call to join().
#include
Hi! To create a new message please do not reply to existing messages and change the subject. Each message has an Id (Thread-Index) in the header which causes the mailing list to sort it as reply to the old message. With Kind Regards, Ovanes Markarian On Wed, August 23, 2006 09:25, Aubrey, Jason wrote:
Hi,
My Environment: * MSVC 8.0 * boost v1.33.1
Using the example program below, I'm getting an assertion within boost's thread class during a call to join. join() is being called twice: 1) in main() 2) in ~Thread(). If I remove one of the calls to join() the assertion goes away. Though this example's usage seems redundant such behavior should be similar to the scenario of multiple threads waiting on the same thread via join().
Help would be appreciated.
Regards, Jason
// --------------------------------- BEGIN EXAMPLE PROGRAM --------------------------- // Assertion failed: m_joinable, file C:\...\boost\boost_1_33_1\libs\thread\build\..\src\thread.cpp, line 223 // Call Stack begins in the following code at the end of main() within ~Thread() in the call to join().
#include
#include #include #include #include // This class misuses inheritance, but is provided for those // familiar with Java syntax that don't care class Thread : public boost::noncopyable { private: boost::shared_ptrboost::thread _thread;
public: Thread(){} virtual ~Thread() { join(); }
void join() { if ( _thread ) _thread->join(); }
virtual void run() = 0;
void start() { if ( !_thread ) _thread.reset( // Reference to the thread new boost::thread( // New thread of execution boost::bind(&Thread::run, this) // Functor calls run() )); } };
struct MyThread : public Thread { void run() {} };
void main() { MyThread t; t.start(); t.join(); // No assertion if this line is commented return; }
// --------------------------------- END EXAMPLE PROGRAM --------------------------- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Aubrey, Jason
-
Ovanes Markarian