Opened 12 years ago

Last modified 12 years ago

#4846 new Bugs

streaming gregorian::date objects to std::cout leaks memory

Reported by: robbie@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

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

consider the following code

// 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 <iostream>           // standard io
#include <sstream>            // string-streams
#include <boost/date_time/gregorian/gregorian.hpp>

int
main()
{
  namespace bg = boost::gregorian;                // namespace alias
  const bg::date today(2010, bg::Nov, 12);        // 'const' not significant
  std::ostringstream oss;
  oss << today;
  std::cout << "today (1) : " << oss.str() << std::endl;  // okay
  std::cout << "today (2) : " << today     << std::endl;  // faulty
}

valgrind output

==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)

Change History (3)

comment:1 by viboes, 12 years ago

The valgrind report don't help too much. Could you Rerun with --leak-check=full and post the details of leaked memory?

comment:2 by robbie@…, 12 years ago

Requested information follows. But now with Boost version 1.45.0. Everything else remains the same:

// 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

Valgrind output:

==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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x406F99: boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::period_formatter(boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61)
==5370==    by 0x406037: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x406FCC: boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::period_formatter(boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61)
==5370==    by 0x406037: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x407020: boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::period_formatter(boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61)
==5370==    by 0x406037: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x407071: boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::period_formatter(boost::date_time::period_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::range_display_options, char const*, char const*, char const*, char const*) (period_formatter.hpp:61)
==5370==    by 0x406037: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x405F90: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x405FE2: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x4075A7: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:75)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x4073F4: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:72)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x40716A: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:67)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x40725C: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:69)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x40736C: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:71)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x407513: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:74)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x4071D4: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:68)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x4072E4: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:70)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x40747F: boost::date_time::date_generator_formatter<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_generator_formatter() (date_generator_formatter.hpp:73)
==5370==    by 0x406065: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x405F5C: boost::date_time::date_facet<boost::gregorian::date, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::date_facet(unsigned long) (date_facet.hpp:90)
==5370==    by 0x40467C: std::basic_ostream<char, std::char_traits<char> >& boost::gregorian::operator<< <char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, boost::gregorian::date const&) (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<char>::allocate(unsigned long, void const*) (new_allocator.h:89)
==5370==    by 0x4EF07AE: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:585)
==5370==    by 0x4EF11E8: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:139)
==5370==    by 0x4EF16BD: char* std::string::_S_construct_aux<char const*>(char const*, char const*, std::allocator<char> const&, std::__false_type) (basic_string.h:1546)
==5370==    by 0x4EF12D4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&) (basic_string.h:1562)
==5370==    by 0x4EECFCD: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:216)
==5370==    by 0x40ABBA: std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > std::__copy_move<false, false, std::random_access_iterator_tag>::__copy_m<char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > >(char const (*) [17], char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > >) (stl_algobase.h:343)
==5370==    by 0x40A3C4: std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > std::__copy_move_a<false, char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > >(char const (*) [17], char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > >) (stl_algobase.h:397)
==5370==    by 0x409779: std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > std::__copy_move_a2<false, char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > >(char const (*) [17], char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > >) (stl_algobase.h:436)
==5370==    by 0x4082C2: std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > std::copy<char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > > >(char const (*) [17], char const (*) [17], std::back_insert_iterator<std::vector<std::string, std::allocator<std::string> > >) (stl_algobase.h:468)
==5370==    by 0x407700: boost::date_time::special_values_formatter<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::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)

Posting ends.

comment:3 by robbie@…, 12 years ago

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.

Note: See TracTickets for help on using tickets.