
Jens Theisen schrieb:
So it's only when you have the dynamic allocation but you don't get an exception. How did you find that there is any leak? Do you have a test program?
Jens
Hi, I'm using vc.net with a tool called "Visual Leak Detector". As I said, when build the boost::thread on the stack or doing dynamic allocation with another thread library (asio socket lib, asio::thread), no leaks are reported. For my purposes asio::thread is sufficient, even though it only provides basic thread functionality. Here is the code and the memory dump: #include "vld.h" // for memory leak detection #include <boost/thread/thread.hpp> void doNothing() {} int main() { boost::thread* thrd = new boost::thread( &doNothing ); thrd->join(); delete thrd; return 0; } Visual Leak Detector Version 1.0 installed (multithreaded static). Der Thread 'Win32 Thread' (0xe54) hat mit Code 0 (0x0) geendet. WARNING: Visual Leak Detector detected memory leaks! ---------- Block 94 at 0x008B2688: 24 bytes ---------- Call Stack: f:\vs70builds\3077\vc\crtbld\crt\src\newop.cpp (12): operator new c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\mutex.inl (55): `anonymous namespace'::new_critical_section c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\mutex.cpp (48): boost::mutex::mutex c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\tss_hooks.cpp (29): `anonymous namespace'::init_threadmon_mutex c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\once.cpp (174): boost::call_once c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\tss_hooks.cpp (150): on_thread_exit c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\thread.cpp (117): thread_proxy f:\vs70builds\3077\vc\crtbld\crt\src\threadex.c (241): _threadstartex 0x7C80B50B (File and line number not available): GetModuleFileNameA Data: 40 3D 14 00 FF FF FF FF 00 00 00 00 00 00 00 00 @=...... ........ 00 00 00 00 00 00 00 00 ........ ........ ---------- Block 93 at 0x008B2820: 8 bytes ---------- Call Stack: f:\vs70builds\3077\vc\crtbld\crt\src\newop.cpp (12): operator new c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\tss_hooks.cpp (29): `anonymous namespace'::init_threadmon_mutex c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\once.cpp (174): boost::call_once c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\tss_hooks.cpp (150): on_thread_exit c:\dokumente und einstellungen\godot\eigene dateien\eigene downloads\boost_1_33_0\libs\thread\src\thread.cpp (117): thread_proxy f:\vs70builds\3077\vc\crtbld\crt\src\threadex.c (241): _threadstartex 0x7C80B50B (File and line number not available): GetModuleFileNameA Data: 88 26 8B 00 01 CD CD CD .&...... ........ Visual Leak Detector detected 2 memory leaks. 'threadConsole.exe': 'C:\WINDOWS\system32\dbghelp.dll' entladen 'threadConsole.exe': 'C:\WINDOWS\system32\version.dll' entladen Visual Leak Detector is now exiting.