Boost C++ Libraries: Ticket #4846: streaming gregorian::date objects to std::cout leaks memory https://svn.boost.org/trac10/ticket/4846 <p> there seems to be a problem streaming boost::gregorian::date objects to std::cout, but not to std::ostringstream / whilst noting that this could be a valgrind issue </p> <p> consider the following code </p> <pre class="wiki">// build : $ g++ -ggdb -Wall -pedantic -Weffc++ test.cc -o test // run : $ valgrind ./test // compiler : g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 // library : Boost 1.44.0 #include &lt;iostream&gt; // standard io #include &lt;sstream&gt; // string-streams #include &lt;boost/date_time/gregorian/gregorian.hpp&gt; int main() { namespace bg = boost::gregorian; // namespace alias const bg::date today(2010, bg::Nov, 12); // 'const' not significant std::ostringstream oss; oss &lt;&lt; today; std::cout &lt;&lt; "today (1) : " &lt;&lt; oss.str() &lt;&lt; std::endl; // okay std::cout &lt;&lt; "today (2) : " &lt;&lt; today &lt;&lt; std::endl; // faulty } </pre><p> valgrind output </p> <pre class="wiki">==15924== Memcheck, a memory error detector ==15924== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==15924== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==15924== Command: ./test ==15924== today (1) : 2010-Nov-12 today (2) : 2010-Nov-12 ==15924== ==15924== HEAP SUMMARY: ==15924== in use at exit: 1,544 bytes in 26 blocks ==15924== total heap usage: 64 allocs, 38 frees, 4,609 bytes allocated ==15924== ==15924== LEAK SUMMARY: ==15924== definitely lost: 0 bytes in 0 blocks ==15924== indirectly lost: 0 bytes in 0 blocks ==15924== possibly lost: 568 bytes in 19 blocks ==15924== still reachable: 976 bytes in 7 blocks ==15924== suppressed: 0 bytes in 0 blocks ==15924== Rerun with --leak-check=full to see details of leaked memory ==15924== ==15924== For counts of detected and suppressed errors, rerun with: -v ==15924== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4846 Trac 1.4.3 viboes Sat, 27 Nov 2010 15:00:54 GMT <link>https://svn.boost.org/trac10/ticket/4846#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4846#comment:1</guid> <description> <p> The valgrind report don't help too much. Could you Rerun with --leak-check=full and post the details of leaked memory? </p> </description> <category>Ticket</category> </item> <item> <author>robbie@…</author> <pubDate>Sat, 27 Nov 2010 18:05:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4846#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4846#comment:2</guid> <description> <p> Requested information follows. But now with Boost version 1.45.0. Everything else remains the same: </p> <pre class="wiki">// build : $ g++ -ggdb -Wall -pedantic -Weffc++ test.cc -o test // run : $ valgrind --leak-check=full ./test // compiler : g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 // library : Boost 1.45.0 </pre><p> Valgrind output: </p> <pre class="wiki">==5370== Memcheck, a memory error detector ==5370== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==5370== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info ==5370== Command: ./test ==5370== today (1) : 2010-Nov-12 today (2) : 2010-Nov-12 ==5370== ==5370== HEAP SUMMARY: ==5370== in use at exit: 1,544 bytes in 26 blocks ==5370== total heap usage: 64 allocs, 38 frees, 4,609 bytes allocated ==5370== ==5370== 26 bytes in 1 blocks are possibly lost in loss record 1 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x406F99: boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::period_formatter(boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61) ==5370== by 0x406037: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 26 bytes in 1 blocks are possibly lost in loss record 2 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x406FCC: boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::period_formatter(boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61) ==5370== by 0x406037: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 26 bytes in 1 blocks are possibly lost in loss record 3 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x407020: boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::period_formatter(boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61) ==5370== by 0x406037: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 26 bytes in 1 blocks are possibly lost in loss record 4 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x407071: boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::period_formatter(boost::date_time::period_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61) ==5370== by 0x406037: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 27 bytes in 1 blocks are possibly lost in loss record 5 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x405F90: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 27 bytes in 1 blocks are possibly lost in loss record 6 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x405FE2: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 27 bytes in 1 blocks are possibly lost in loss record 7 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x4075A7: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:75) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 29 bytes in 1 blocks are possibly lost in loss record 8 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x4073F4: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:72) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 30 bytes in 1 blocks are possibly lost in loss record 9 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x40716A: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:67) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 30 bytes in 1 blocks are possibly lost in loss record 10 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x40725C: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:69) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 30 bytes in 1 blocks are possibly lost in loss record 11 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x40736C: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:71) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 30 bytes in 1 blocks are possibly lost in loss record 12 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x407513: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:74) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 31 bytes in 1 blocks are possibly lost in loss record 13 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x4071D4: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:68) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 31 bytes in 1 blocks are possibly lost in loss record 14 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x4072E4: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:70) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 31 bytes in 1 blocks are possibly lost in loss record 15 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x40747F: boost::date_time::date_generator_formatter&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_generator_formatter() (date_generator_formatter.hpp:73) ==5370== by 0x406065: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 33 bytes in 1 blocks are possibly lost in loss record 17 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x405F5C: boost::date_time::date_facet&lt;boost::gregorian::date, char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::date_facet(unsigned long) (date_facet.hpp:90) ==5370== by 0x40467C: std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; boost::gregorian::operator&lt;&lt; &lt;char, std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, boost::gregorian::date const&amp;) (gregorian_io.hpp:62) ==5370== by 0x402A69: main (frag-boost-date-time-memoryleak-1.cc:37) ==5370== ==5370== 108 bytes in 3 blocks are possibly lost in loss record 21 of 24 ==5370== at 0x4C27CC1: operator new(unsigned long) (vg_replace_malloc.c:261) ==5370== by 0x4EF14E0: __gnu_cxx::new_allocator&lt;char&gt;::allocate(unsigned long, void const*) (new_allocator.h:89) ==5370== by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:585) ==5370== by 0x4EF11E8: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::forward_iterator_tag) (basic_string.tcc:139) ==5370== by 0x4EF16BD: char* std::string::_S_construct_aux&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;, std::__false_type) (basic_string.h:1546) ==5370== by 0x4EF12D4: char* std::string::_S_construct&lt;char const*&gt;(char const*, char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.h:1562) ==5370== by 0x4EECFCD: std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;) (basic_string.tcc:216) ==5370== by 0x40ABBA: std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; std::__copy_move&lt;false, false, std::random_access_iterator_tag&gt;::__copy_m&lt;char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; &gt;(char const (*) [17], char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt;) (stl_algobase.h:343) ==5370== by 0x40A3C4: std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; std::__copy_move_a&lt;false, char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; &gt;(char const (*) [17], char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt;) (stl_algobase.h:397) ==5370== by 0x409779: std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; std::__copy_move_a2&lt;false, char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; &gt;(char const (*) [17], char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt;) (stl_algobase.h:436) ==5370== by 0x4082C2: std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; std::copy&lt;char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt; &gt;(char const (*) [17], char const (*) [17], std::back_insert_iterator&lt;std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt; &gt;) (stl_algobase.h:468) ==5370== by 0x407700: boost::date_time::special_values_formatter&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt; &gt; &gt;::special_values_formatter() (special_values_formatter.hpp:43) ==5370== ==5370== LEAK SUMMARY: ==5370== definitely lost: 0 bytes in 0 blocks ==5370== indirectly lost: 0 bytes in 0 blocks ==5370== possibly lost: 568 bytes in 19 blocks ==5370== still reachable: 976 bytes in 7 blocks ==5370== suppressed: 0 bytes in 0 blocks ==5370== Reachable blocks (those to which a pointer was found) are not shown. ==5370== To see them, rerun with: --leak-check=full --show-reachable=yes ==5370== ==5370== For counts of detected and suppressed errors, rerun with: -v ==5370== ERROR SUMMARY: 17 errors from 17 contexts (suppressed: 4 from 4) </pre><p> Posting ends. </p> </description> <category>Ticket</category> </item> <item> <author>robbie@…</author> <pubDate>Sat, 27 Nov 2010 18:08:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4846#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4846#comment:3</guid> <description> <p> Just one further thing. I believe I struck the same issue about three releases back. But didn't report because I was extremely busy on my PhD. Sorry. </p> </description> <category>Ticket</category> </item> </channel> </rss>