id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 10621,CRT Debug Heap reports leak when including exception_ptr.hpp,dinazil@…,Emil Dotchevski,"I created a Win32 Console application with Visual Studio 2013 (vc12) and Boost 1.56.0. This is my only file: {{{ #define _CRTDBG_MAP_ALLOC #include #include //#define CHECK_THREAD #ifdef CHECK_THREAD #include #else #ifdef _DEBUG #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__) #else #define DEBUG_CLIENTBLOCK #endif // _DEBUG #ifdef _DEBUG #define new DEBUG_CLIENTBLOCK #endif #include #endif #include int main() { HANDLE hLogFile = CreateFile(L""MemoryLeaks.txt"", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); //Turn on debugging for memory leaks. This is automatically turned off when the build is Release. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, hLogFile); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, hLogFile); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, hLogFile); _CrtDumpMemoryLeaks(); CloseHandle(hLogFile); return 0; } }}} When I run this I get the following output in MemoryLeaks.txt: {{{ Detected memory leaks! Dumping objects -> c:\workspace\externals\boost_1_56_0\include\boost\smart_ptr\detail\shared_count.hpp(130) : {156} client block at 0x00709AC8, subtype 0, 16 bytes long. Data: < 0 p > 84 0F 0C 00 02 00 00 00 01 00 00 00 30 9A 70 00 {155} normal block at 0x00709A88, 14 bytes long. Data: 62 61 64 20 65 78 63 65 70 74 69 6F 6E 00 c:\workspace\externals\boost_1_56_0\include\boost\exception\detail\exception_ptr.hpp(130) : {154} client block at 0x00709A30, subtype 0, 44 bytes long. Data: < @ > 04 0E 0C 00 00 00 00 00 40 0E 0C 00 F0 0C 0C 00 c:\workspace\externals\boost_1_56_0\include\boost\smart_ptr\detail\shared_count.hpp(130) : {151} client block at 0x007089B0, subtype 0, 16 bytes long. Data: 68 0F 0C 00 02 00 00 00 01 00 00 00 58 89 70 00 c:\workspace\externals\boost_1_56_0\include\boost\exception\detail\exception_ptr.hpp(130) : {150} client block at 0x00708958, subtype 0, 44 bytes long. Data: < X > B4 0C 0C 00 00 00 00 00 58 0D 0C 00 F0 0C 0C 00 Object dump complete. }}} I first discovered this issue in a unit test which included boost/thread.hpp. However the unit tests don't include source and line information about the leak and thread.hpp doesn't compile with the DEBUG_CLIENTBLOCK macro. So I started eliminating all includes until I found out that the one causing the reported leak was exception_ptr and luckily enough this one did compile with the macro. I'm attaching the solution. It assumes that the Boost library resides in c:\workspace\boost_1_56_0. Thanks!",Bugs,closed,To Be Determined,exception,Boost 1.56.0,Problem,invalid,,