You had mistaken "reachable" code with memory leaks... Especially if some std::locale::global remains etc. It is not a bug nor even a problem. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
________________________________ From: Jookia <166291@gmail.com> To: boost@lists.boost.org Sent: Sunday, March 3, 2013 10:19 PM Subject: [boost] [locale] Memory leaks?
Hello!
I've been debugging my application that uses Boost.Locale for the past five hours or so, and I've found it curious that it leaks memory.
In order to stop it, I have to do a couple of weird things, such as including ICU in to my projects and calling u_cleanup at the end of my application. I also have to disable certain facets. I've put all this together in some source code, that by default won't leak, but uncommenting various parts will cause it to leak:
// ---- BEGIN CODE ----------------------------------------------------
#include
#include #include <iostream> using namespace boost::locale; using namespace std;
int main() { generator gen; gen.categories( convert_facet | //collation_facet | // Various errors. //formatting_facet | // Various errors. //parsing_facet | // Various errors. message_facet | //codepage_facet | // Various errors. boundary_facet | calendar_facet | information_facet);
locale newLoc = gen("zh_CN.GB18030");
locale::global(newLoc); cout.imbue(newLoc);
// ios_info::get doesn't clean up after itself. //cout << as::date << time(0) << endl;
// Do this at the end of the program to clean up resources. locale::global(std::locale("C")); cout.imbue(std::locale("C")); u_cleanup(); }
// ---- END CODE ------------------------------------------------------
Dumping this as 'hello.cpp' and running this is how I'm debugging it:
g++ hello.cpp -lboost_locale -licuuc && valgrind --leak-check=full --show-reachable=yes ./a.out
Thanks, Jookia.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost