On Wed, 22 Feb 2006 20:18:53 -0800, Stewart Loving-Gibbard wrote
We have observed leaky behavior while using the Boost.date-time libraries, with time_from_string specifically. The leak is simple to replicate for us, on both Win32 (Visual Studio .NET 2005) and on Linux (GCC 3.x).
This code snippet leaks for us, at a rate of about a MB every 10 seconds:
while (true) { time_from_string("2002-01-20 23:59:59"); }
As far as I can tell, ptime (what time_from_string returns) is an object that doesn't need to be deallocated with a Boost API function. So, why are we leaking here? Did we compile Boost incorrectly? Is there a way to link Boost that can trigger a leak?
(from_iso_string() also appears to leak for us, by the way, while to_iso_string does not. It looks like time_from_string and to_iso_string are in the same neighborhood, so I'm betting they share the same fix.)
Any and all help appreciated. This is a blocking issue for us.
It's a problem in the standard library. Have a look at this recent thread. A few key emails: http://lists.boost.org/Archives/boost/2006/02/100969.php http://lists.boost.org/Archives/boost/2006/02/101039.php http://lists.boost.org/Archives/boost/2006/02/101122.php As you'll see in the last email I've made some patches, but it isn't comprehensive. In particular, time_from_string is in one of those areas that I don't believe I can patch easily. If you're doing any non-trivial C++, I think you'll want to request support from the vendor or apply their workarounds since date-time is hardly the only code likely to be using basic_iostream. Jeff