Boost logo

Boost Users :

Subject: Re: [Boost-users] boost.regex with ICU memory cleanup on windows
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-08-02 07:14:53


>I recently asked this on stack overflow boost with icu u32_regex memory
>leak / cache on
>Win32<http://stackoverflow.com/questions/6867664/boost-with-icu-u32-regex-memory-leak-cache-on-win32>
>but
>haven't been able to solve issue yet so thought I would ask here as well.

There are a number of issues here:

1) Your call to u_cleanup() occurs while a u32regex object is still in
existence, so any ICU data being cached is actually still being used at that
point.
2) Boost.Regex does cache some internal data for improved performance - this
is relatively small and gets cleared after main() exits.
3) Point (2) means that a call to _CrtDumpMemoryLeaks() before main exits
will report leaks, where as using something like:

struct cleanup
{
   ~cleanup()
   {
      _CrtDumpMemoryLeaks();
   }
};

cleanup c;

To report leaks results in no leak reports.

4) Other leak detectors such as valgrind and VLD report no errors (and give
much more useful reports than the brain-dead MS ones IMO).

HTH, John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net