boost.regex with ICU memory cleanup on windows

Hi,
I recently asked this on stack overflow boost with icu u32_regex memory leak / cache on Win32http://stackoverflow.com/questions/6867664/boost-with-icu-u32-regex-memory-l... but haven't been able to solve issue yet so thought I would ask here as well.
The problem I'm having is that I can't seem to clean up the ICU data when it is loaded by boost regex using the optional icu linkage to support Unicode regex's.
I'll copy the example source I posted above:-
#define BOOST_TEST_MAIN //Ask boost unit test framework to create a main for us
#define BOOST_ALL_DYN_LINK //Ask boost to link to dynamic library rather than purely header support where appropriate
#include

I recently asked this on stack overflow boost with icu u32_regex memory leak / cache on Win32http://stackoverflow.com/questions/6867664/boost-with-icu-u32-regex-memory-l... 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.
participants (2)
-
Alex Perry
-
John Maddock