Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9181: memory leak in Date_Time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-12 16:33:09
#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
Resolution: | Keywords: Date_Time memory leak
-------------------------------+-----------------------------------
Comment (by andysem):
Replying to [comment:1 Georg Sauthoff <mail@â¦>]:
> I've reproduced your valgrind output on Fedora 19 (boost 1.53, gcc
4.8.2).
>
> The source seems to be
>
> /usr/include/boost/date_time/gregorian/gregorian_io.hpp:62
>
> {{{
> custom_date_facet* f = new custom_date_facet();
> }}}
>
> and
>
> /usr/include/boost/date_time/posix_time/posix_time_io.hpp:59
>
> {{{
> custom_ptime_facet* f = new custom_ptime_facet();
> }}}
>
> inside a {{{operator<<()}}} definition.
This is not a leak. The ownership of the facet is transferred to the
locale object. The facet will be deleted when the locale is.
Regarding the valgrind report, I think this is due to the fact that the
locale does not get deleted when valgrind makes its report. This is
because standard streams are not destroyed at this point.
You can try adding "std::cout.imbue(std::locale())" at the end of your
main() and see if the facet is deleted then.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9181#comment:2> 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:15 UTC