[Boost-bugs] [Boost C++ Libraries] #9181: memory leak in Date_Time

Subject: [Boost-bugs] [Boost C++ Libraries] #9181: memory leak in Date_Time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-30 12:42:48


#9181: memory leak in Date_Time
-----------------------------------+------------------------
 Reporter: gregory@… | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: Date_Time memory leak |
-----------------------------------+------------------------
 It looks like there is a memory leak when streaming Date_Time objects to
 standard output. Consider the following simple code:

 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <iostream>

 using namespace boost::posix_time;

 int main() {
     ptime time(boost::gregorian::date(2013, 9, 30), hours(14) +
 minutes(42));
     std::cout << time << '\n';
     std::cout << time.date() << '\n';
     std::cout << time.date().month() << '\n';
     std::cout << time.time_of_day() << '\n';
 }

 Compiling: g++ -lboost_date_time bug.cpp
 Testing: valgrind ./a.out

 ==8994== Memcheck, a memory error detector
 ==8994== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
 ==8994== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
 ==8994== Command: ./a.out
 ==8994==
 2013-Sep-30 14:42:00
 2013-Sep-30
 Sep
 14:42:00
 ==8994==
 ==8994== HEAP SUMMARY:
 ==8994== in use at exit: 2,491 bytes in 49 blocks
 ==8994== total heap usage: 82 allocs, 33 frees, 8,448 bytes allocated
 ==8994==
 ==8994== LEAK SUMMARY:
 ==8994== definitely lost: 0 bytes in 0 blocks
 ==8994== indirectly lost: 0 bytes in 0 blocks
 ==8994== possibly lost: 1,187 bytes in 39 blocks
 ==8994== still reachable: 1,304 bytes in 10 blocks
 ==8994== suppressed: 0 bytes in 0 blocks
 ==8994== Rerun with --leak-check=full to see details of leaked memory
 ==8994==
 ==8994== For counts of detected and suppressed errors, rerun with: -v
 ==8994== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

 (please find the --leak-check=full output attached). I'm using Ubuntu
 12.04 LTS, Boost 1.48.0-3, and gcc 4.6.3.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9181>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC