
Seweryn Habdank-Wojewódzki wrote:
Hi
I do not know if date time leaks or not,
Don't think so.
but I want to clarify that before I will send information to libstdc++ bugzilla.
Not sure there's really a leak...
date b1 (2007,2,3); date b2 (2007,2,7);
cout << b1 << '\n'; // line 12
This statement will install the default date-time output facet. Facet's have a reference counting mechanism which should provide for release upon destruction of the stream. So there wouldn't be any removal till the end of the program.
[2007-Feb-03/2007-Feb-06] ==2382== ==2382== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 1) ==2382== malloc/free: in use at exit: 856 bytes in 26 blocks. ==2382== malloc/free: 58 allocs, 32 frees, 2,772 bytes allocated. ==2382== For counts of detected errors, rerun with: -v ==2382== searching for pointers to 26 not-freed blocks. ==2382== checked 107,996 bytes. ==2382== ==2382== 20 bytes in 1 blocks are still reachable in loss record 1 of 7 ==2382== at 0x4021FB4: operator new(unsigned) (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so) ==2382== by 0x8049CDD: std::locale::locale<boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > > >(std::locale const&, boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >*) (locale_classes.h:568)
This is the aforementioned facet.
...snip.... ==2382== LEAK SUMMARY: ==2382== definitely lost: 0 bytes in 0 blocks. ==2382== possibly lost: 340 bytes in 19 blocks. ==2382== still reachable: 516 bytes in 7 blocks. ==2382== suppressed: 0 bytes in 0 blocks.
'possibly lost' seems less than conclusive that there's actually a leak. Jeff