Opened 8 years ago
Closed 5 years ago
#11009 closed Bugs (worksforme)
Possible memory leak in gregorian::from_simple_string
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | Boost 1.66.0 | Component: | date_time |
Version: | Boost 1.57.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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 <boost/date_time/gregorian/gregorian.hpp> 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<char> const&) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::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<boost::gregorian::greg_month>(std::string const&) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date<boost::gregorian::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<char> const&) (new_allocator.h:104) ==19696== by 0x4CEF4FA: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (basic_string.tcc:629) ==19696== by 0x4CEFB7B: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::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<boost::gregorian::greg_month>(std::string const&) (date_parsing.hpp:67) ==19696== by 0x405057: boost::gregorian::date boost::date_time::parse_date<boost::gregorian::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)
Change History (2)
comment:1 by , 5 years ago
Owner: | changed from | to
---|
comment:2 by , 5 years ago
Milestone: | To Be Determined → Boost 1.66.0 |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Cannot reproduce this on boost 1.66.0.