id summary reporter owner description type status milestone component version severity resolution keywords cc 11009 Possible memory leak in gregorian::from_simple_string lszczygielek@… James E. King, III "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: {{{ #include using namespace std; int main() { boost::gregorian::from_simple_string(""2015-Jan-1""); boost::gregorian::from_simple_string(""2015-January-1""); return 0; } }}} {{{ 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 const&) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string, std::allocator >::basic_string(std::string const&) (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(std::string const&) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date(std::string const&, 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 const&) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator const&, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string, std::allocator >::basic_string(std::string const&) (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(std::string const&) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date(std::string const&, 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) }}} " Bugs closed Boost 1.66.0 date_time Boost 1.57.0 Problem worksforme