Boost C++ Libraries: Ticket #11009: Possible memory leak in gregorian::from_simple_string https://svn.boost.org/trac10/ticket/11009 <p> Hi, I've made some unit test to my code where I use date_time and Valgrind reports me possible memory leak. Here is code sample: </p> <pre class="wiki">#include &lt;boost/date_time/gregorian/gregorian.hpp&gt; using namespace std; int main() { boost::gregorian::from_simple_string("2015-Jan-1"); boost::gregorian::from_simple_string("2015-January-1"); return 0; } </pre><pre class="wiki">valgrind --leak-check=full ./DateTimeMemoryLeak ==19696== Memcheck, a memory error detector ==19696== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==19696== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==19696== Command: ./DateTimeMemoryLeak ==19696== ==19696== ==19696== HEAP SUMMARY: ==19696== in use at exit: 1,858 bytes in 48 blocks ==19696== total heap usage: 110 allocs, 62 frees, 3,713 bytes allocated ==19696== ==19696== 308 bytes in 11 blocks are possibly lost in loss record 3 of 6 ==19696== at 0x4A075BC: operator new(unsigned long) (vg_replace_malloc.c:298) ==19696== by 0x4CEE928: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator&lt;char&gt; const&amp;, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(std::string const&amp;) (basic_string.h:229) ==19696== by 0x408AA2: boost::gregorian::greg_month::get_month_map_ptr() (in /home/Lukasz/projekty/build-DateTimeMemoryLeak-Desktop_Qt_5_3_0_g_4_8_0-Debug/DateTimeMemoryLeak) ==19696== by 0x405BEF: unsigned short boost::date_time::month_str_to_ushort&lt;boost::gregorian::greg_month&gt;(std::string const&amp;) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date&lt;boost::gregorian::date&gt;(std::string const&amp;, int) (date_parsing.hpp:143) ==19696== by 0x404793: boost::gregorian::from_simple_string(std::string) (parsers.hpp:35) ==19696== by 0x403D57: main (main.cpp:9) ==19696== ==19696== 374 bytes in 12 blocks are possibly lost in loss record 4 of 6 ==19696== at 0x4A075BC: operator new(unsigned long) (vg_replace_malloc.c:298) ==19696== by 0x4CEE928: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator&lt;char&gt; const&amp;, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(std::string const&amp;) (basic_string.h:229) ==19696== by 0x4087E7: boost::gregorian::greg_month::get_month_map_ptr() (in /home/Lukasz/projekty/build-DateTimeMemoryLeak-Desktop_Qt_5_3_0_g_4_8_0-Debug/DateTimeMemoryLeak) ==19696== by 0x405BEF: unsigned short boost::date_time::month_str_to_ushort&lt;boost::gregorian::greg_month&gt;(std::string const&amp;) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date&lt;boost::gregorian::date&gt;(std::string const&amp;, int) (date_parsing.hpp:143) ==19696== by 0x404793: boost::gregorian::from_simple_string(std::string) (parsers.hpp:35) ==19696== by 0x403D57: main (main.cpp:9) ==19696== ==19696== LEAK SUMMARY: ==19696== definitely lost: 0 bytes in 0 blocks ==19696== indirectly lost: 0 bytes in 0 blocks ==19696== possibly lost: 682 bytes in 23 blocks ==19696== still reachable: 1,176 bytes in 25 blocks ==19696== suppressed: 0 bytes in 0 blocks ==19696== Reachable blocks (those to which a pointer was found) are not shown. ==19696== To see them, rerun with: --leak-check=full --show-reachable=yes ==19696== ==19696== For counts of detected and suppressed errors, rerun with: -v ==19696== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 6 from 6) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11009 Trac 1.4.3 James E. King, III Wed, 27 Dec 2017 19:23:45 GMT owner changed https://svn.boost.org/trac10/ticket/11009#comment:1 https://svn.boost.org/trac10/ticket/11009#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">az_sw_dude</span> to <span class="trac-author">James E. King, III</span> </li> </ul> Ticket James E. King, III Wed, 27 Dec 2017 19:24:12 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/11009#comment:2 https://svn.boost.org/trac10/ticket/11009#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.66.0</span> </li> </ul> <p> Cannot reproduce this on boost 1.66.0. </p> Ticket