|
Boost : |
Subject: Re: [boost] [date_time] memory leak?
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2010-03-18 06:37:15
Bartosz Marcinkiewicz wrote:
> Hello,
>
> Code:
>
> #include <iostream>
> #include <boost/date_time/posix_time/posix_time.hpp>
>
> int main()
> {
> std::cout << boost::posix_time::microsec_clock::local_time() << std::endl;
> return 0;
> }
>
> Running through valgrind yields this:
With valgrind --leak-check=full I get a similar report.
> ==5963== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 2)
> ==5963== malloc/free: in use at exit: 1,595 bytes in 27 blocks.
> ==5963== malloc/free: 63 allocs, 36 frees, 7,878 bytes allocated.
> ==5963== For counts of detected errors, rerun with: -v
> ==5963== searching for pointers to 27 not-freed blocks.
> ==5963== checked 173,784 bytes.
> ==5963==
> ==5963== 619 bytes in 20 blocks are possibly lost in loss record 7 of 7
> ==5963== at 0x4A06FFC: operator new(unsigned long) (vg_replace_malloc.c:230)
> ==5963== by 0x352C0A0140: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.12)
> ==5963== by 0x352C0A0D64: (within /usr/lib64/libstdc++.so.6.0.12)
> ==5963== by 0x352C0A0F01: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib64/libstdc++.so.6.0.12)
> ==5963== by 0x408AD7: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (in /home/bma/c++/boost_dt)
> ==5963== by 0x407B20: boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::time_facet(unsigned long) (in /home/bma/c++/boost_dt)
> ==5963== by 0x40494B: std::basic_ostream<char, std::char_traits<char> >& boost::posix_time::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::posix_time::ptime const&) (in /home/bma/c++/boost_dt)
> ==5963== by 0x402AA0: main (in /home/bma/c++/boost_dt)
> ==5963==
> ==5963== LEAK SUMMARY:
> ==5963== definitely lost: 0 bytes in 0 blocks.
> ==5963== possibly lost: 619 bytes in 20 blocks.
> ==5963== still reachable: 976 bytes in 7 blocks.
> ==5963== suppressed: 0 bytes in 0 blocks.
> ==5963== Reachable blocks (those to which a pointer was found) are not shown.
> ==5963== To see them, rerun with: --leak-check=full --show-reachable=yes
>
> This is boost-1.37.0-9.fc11 (fedora core 11), gcc 4.4.1, x86-64 platform.
> Is it memory leak?
>
> Best regards, bma.
--> Mika Heiskanen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk