Subject: [boost] Is it a bug in old version of boost?
From: Bill David (billdavidcn_at_[hidden])
Date: 2009-02-12 03:18:28
I have the following code in my application. But I find it causes a serious
memory leak with a product we are using. Our application is a plug-in to
this product. But we are not sure what's the boost version included by this
The following is the code (On Windows, the product should be written with
Visual Studio 2003/2005):
* @brief Convert modify time string to time_t for easy internal handling
* @param str Modify time string returned by HTTP server, e.g. "Fri, 18 Jul
2008 11:53:14 GMT"
* @return Corresponding time_t result
time_t parseDate(const string& str)
time_input_facet* timefacet = new time_input_facet("%a, %d %b %Y
%H:%M:%S %z"); // will be automatically deleted by related locale object
ss >> p;
tm t = to_tm(p);
And we find the problem is caused by
time_input_facet* timefacet = new time_input_facet("%a, %d %b %Y %H:%M:%S
it seems related memory has not been released by locale or some memory is
leaked by time_input_facet.
We have tested above code separately with boost 1.35.0, 1.37.0, it's OK. So
can anybody tell me if it's any problem in above code? Or is it a bug in old
version of boost date_time or MS Visual Studio 2003/2005? Or how can I work