Boost C++ Libraries: Ticket #13408: Boost Library Possible memory Leak https://svn.boost.org/trac10/ticket/13408 <p> Hi, </p> <p> We have been using Boost library in the project. I've made analysis by using Valgrind tool to be able to find possible memory leaks. According to the result, there is a memory leak in Boost library. </p> <pre class="wiki">==7535== 24 bytes in 1 blocks are still reachable in loss record 2 of 6 ==7535== at 0x4C2B0E0: operator new(unsigned long) (vg_replace_malloc.c:324) ==7535== by 0x4E430A3: boost::detail::make_external_thread_data() (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x4E433DB: boost::detail::add_new_tss_node(void const*, boost::shared_ptr&lt;boost::detail::tss_cleanup_function&gt;, void*) (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x4E4408C: boost::detail::set_tss_data(void const*, boost::shared_ptr&lt;boost::detail::tss_cleanup_function&gt;, void*, bool) (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x54CAC0C: boost::log::v2_mt_posix::core::add_thread_attribute(boost::log::v2_mt_posix::attribute_name const&amp;, boost::log::v2_mt_posix::attribute const&amp;) </pre><p> It seems like the allocated memory is not deallocated, so it causes memory leak. Here is the definition of relevant event ; </p> <pre class="wiki"> thread_data_base* make_external_thread_data() { thread_data_base* const me(detail::heap_new&lt;externally_launched_thread&gt;()); me-&gt;self.reset(me); set_current_thread_data(me); return me; } thread_data_base* get_or_make_current_thread_data() { thread_data_base* current_thread_data(get_current_thread_data()); if(!current_thread_data) { current_thread_data=make_external_thread_data(); } return current_thread_data; } </pre><p> I've made some research if there is any post which states that this event causes memory leak, but could not find any. Is there any fix for the problem stated above? If there is any, could you please state the relevant patch ? </p> <p> Thanks in advance, </p> <p> Kind Regards </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13408 Trac 1.4.3 Kohei Takahashi Mon, 22 Jan 2018 01:43:31 GMT component changed; owner set https://svn.boost.org/trac10/ticket/13408#comment:1 https://svn.boost.org/trac10/ticket/13408#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket viboes Tue, 20 Feb 2018 17:15:30 GMT owner, description changed https://svn.boost.org/trac10/ticket/13408#comment:2 https://svn.boost.org/trac10/ticket/13408#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/13408?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket viboes Tue, 20 Feb 2018 17:17:53 GMT <link>https://svn.boost.org/trac10/ticket/13408#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13408#comment:3</guid> <description> <p> Are you sure your thread has been joined? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 13 Apr 2018 06:49:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13408#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13408#comment:4</guid> <description> <p> This is allocated for native threads that are using the Boost.Thread API. </p> <p> Could you check if the program is calling to <code>tls_destructor</code> before/after doing the report? </p> <pre class="wiki">extern "C" { static void tls_destructor(void* data) </pre><p> Wondering if this isn't associated to some DLL issues. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 13 Apr 2018 06:49:36 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/13408#comment:5 https://svn.boost.org/trac10/ticket/13408#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Fri, 13 Apr 2018 06:53:58 GMT <link>https://svn.boost.org/trac10/ticket/13408#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13408#comment:6</guid> <description> <p> See <a class="ext-link" href="https://svn.boost.org/trac10/ticket/13008"><span class="icon">​</span>https://svn.boost.org/trac10/ticket/13008</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 14 Apr 2018 06:37:19 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/13408#comment:7 https://svn.boost.org/trac10/ticket/13408#comment:7 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> Moved to support until we know that the threads are finished and joined before valgrind report. </p> Ticket