Boost C++ Libraries: Ticket #10795: Include asio/ssl/context.hpp reports two leaks on Windows https://svn.boost.org/trac10/ticket/10795 <p> Simply including the header file &lt;boost/asio/ssl/context.hpp&gt; causes the Microsoft Visual Studio debug runtime (MSVCRTD library) to report two 32 byte leaks on exit. It is not clear if these are from asio or from OpenSSL. This sample program compiled for 64-bit Windows using Visual Studio 2013 demonstrates the problem: </p> <pre class="wiki">#include &lt;boost/asio/ssl/context.hpp&gt; #include &lt;crtdbg.h&gt; int main() { int flags = _CrtSetDbgFlag (_CRTDBG_REPORT_FLAG); flags |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag (flags); } </pre><p> This report is shown on exit, when main returns: </p> <pre class="wiki">Detected memory leaks! Dumping objects -&gt; {716} normal block at 0x00000000003953F0, 32 bytes long. Data: &lt; &gt; 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 {715} normal block at 0x00000000003952D0, 32 bytes long. Data: &lt; S9 &gt; 00 00 00 00 CD CD CD CD F0 53 39 00 00 00 00 00 Object dump complete. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10795 Trac 1.4.3 vz-boost@… Fri, 06 May 2016 21:11:07 GMT <link>https://svn.boost.org/trac10/ticket/10795#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10795#comment:1</guid> <description> <p> I think it's the <a class="ext-link" href="https://github.com/Microsoft/cpprestsdk/issues/67"><span class="icon">​</span>same bug</a> that I reported in C++ REST SDK which uses ASIO: it's due to calling <code>SSL_library_init()</code> from <code>openssl_init_base::do_init</code> ctor but not calling <code>SSL_COMP_free_compression_methods()</code> anywhere. </p> </description> <category>Ticket</category> </item> <item> <author>Vinnie Falco <vinnie.falco@…></author> <pubDate>Fri, 06 May 2016 21:24:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10795#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10795#comment:2</guid> <description> <p> As a work-around, can a program just call <code>SSL_COMP_free_compression_methods</code> manually at the end of <code>main</code>? That would help reduce the volume of false positive leaks. </p> </description> <category>Ticket</category> </item> <item> <author>vz-boost@…</author> <pubDate>Fri, 06 May 2016 21:33:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10795#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10795#comment:3</guid> <description> <p> This is unfortunately impossible when using C++ REST SDK, which is the whole reason for opening the above bug in the first place: it links to OpenSSL statically, so I can't work around the leak from outside it. </p> <p> For now I've made an <a class="ext-link" href="https://github.com/Microsoft/cpprestsdk/pull/143"><span class="icon">​</span>ugly patch</a> fixing this there, but it would be clearly preferable to have the fix in ASIO itself. </p> </description> <category>Ticket</category> </item> </channel> </rss>