Boost C++ Libraries: Ticket #13305: memory leaks https://svn.boost.org/trac10/ticket/13305 <p> I create a logger in the main thread. If the logger is called from another std::thread there are no problems, but if it's called from the concurrency::create_task - there are lot of memory leaks. Visual Studio 2015, Boost versions: 1.57 and 1.65.1. For example: </p> <pre class="wiki">Dumping objects -&gt; {887} normal block at 0x00B6A0F8, 128 bytes long. Data: &lt; TimeStamp: 2017&gt; 00 54 69 6D 65 53 74 61 6D 70 3A 20 32 30 31 37 </pre><p> Best regards, Victor. </p> <p> The sample code: </p> <pre class="wiki">// ConsoleApplication_wo_MFC.cpp : Defines the entry point for the console application. // #define _CRT_SECURE_NO_WARNINGS #define BOOST_SYSTEM_NO_DEPRECATED #define BOOST_LIB_DIAGNOSTIC #define CGAL_LIB_DIAGNOSTIC #include &lt;stdio.h&gt; #include &lt;tchar.h&gt; #include &lt;windows.h&gt; #include &lt;ppltasks.h&gt; #include &lt;thread&gt; #define _CRTDBG_MAP_ALLOC #include &lt;stdlib.h&gt; #include &lt;crtdbg.h&gt; #include &lt;boost/log/core.hpp&gt; #include &lt;boost/log/expressions.hpp&gt; #include &lt;boost/log/attributes.hpp&gt; #include &lt;boost/log/utility/setup/common_attributes.hpp&gt; #include &lt;boost/log/sources/severity_channel_logger.hpp&gt; #include &lt;boost/log/trivial.hpp&gt; #include &lt;boost/log/support/date_time.hpp&gt; #include &lt;boost/log/utility/setup/console.hpp&gt; #include &lt;boost\log\sinks\text_file_backend.hpp&gt; #include &lt;boost/locale/localization_backend.hpp&gt; #if !defined(BOOST_LOG_NO_THREADS) #include &lt;boost/thread/locks.hpp&gt; #include &lt;boost/thread/mutex.hpp&gt; #endif // !defined(BOOST_LOG_NO_THREADS) using namespace std; namespace logging = boost::log; namespace src = boost::log::sources; namespace sinks = boost::log::sinks; namespace keywords = boost::log::keywords; namespace expr = boost::log::expressions; BOOST_LOG_ATTRIBUTE_KEYWORD(a_channel, "Channel", std::string) int main() { int nRetCode = 0; _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); typedef sinks::synchronous_sink&lt;sinks::text_file_backend&gt; file_sink; src::severity_channel_logger_mt&lt;boost::log::trivial::severity_level&gt; logger(keywords::channel = "L"); boost::shared_ptr&lt;file_sink&gt; sinkT(new file_sink(keywords::file_name = "logs\\TestLogger_%6N.log")); sinkT-&gt;set_formatter ( expr::stream &lt;&lt; " TimeStamp: " &lt;&lt; expr::format_date_time&lt; boost::posix_time::ptime &gt;("TimeStamp", "%Y-%m-%d %H:%M:%S") &lt;&lt; " ThreadID: " &lt;&lt; expr::attr&lt;logging::thread_id&gt;("ThreadID") &lt;&lt; " Message: " &lt;&lt; expr::smessage ); logging::core::get()-&gt;add_sink(sinkT); sinkT-&gt;set_filter(a_channel == "L"); logging::add_common_attributes(); BOOST_LOG(logger) &lt;&lt; L"A message from the MAIN thread"; std::thread testTthread([&amp;]() { BOOST_LOG(logger) &lt;&lt; L"A message from the std::thread"; }); testTthread.join(); auto task = concurrency::create_task([&amp;]() { // Produces memory leaks BOOST_LOG(logger) &lt;&lt; L"A message from the concurrency::create_task thread"; }); task.wait(); BOOST_LOG(logger) &lt;&lt; L"Is concurrency::create_task done: " &lt;&lt; task.is_done(); return nRetCode; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13305 Trac 1.4.3