Boost logo

Boost :

Subject: Re: [boost] [locale] Memory leaks?
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2013-03-07 15:39:28


Jookia, I don't think this is a problem at all. Reachable code is not a memory leak. The data is eventually got destroyed, also note that we as users do not really have control of how lib deallocates resources. For example this code is perfectly fine code: #include <locale> #include <iostream> struct fct : public std::locale::facet {         static std::locale::id id;         fct(size_t n = 0) : std::locale::facet(n) {                 x=new int(1);         }         virtual ~fct() { delete x; }         int *x; }; std::locale::id fct::id; int main() {         std::locale l(std::locale(),new fct(0));         std::locale::global(l);         std::cout.imbue(l); } But valgrind reports reachable code... There is nothing you can do.   Artyom Beilis -------------- CppCMS - C++ Web Framework:   http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ ----- Original Message ----- > From: Jookia <166291_at_[hidden]> > To: boost_at_[hidden] > Cc: > Sent: Thursday, March 7, 2013 10:31 PM > Subject: Re: [boost] [locale] Memory leaks? > > Ah. Is that the only gripe with the patch? If so, I'm happy to rework it > based on the lifetime of all the ICU backends. > > On 08/03/13 07:27, Artyom Beilis wrote: >> No because if you cleanup something in ICU and than some >> global object that uses ICU is being destroyed after >> you'll get in trouble. >> >> There is no guarantee on order of destruction of global objects >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework:  http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > _______________________________________________ > Unsubscribe & other changes: > http://lists.boost.org/mailman/listinfo.cgi/boost >


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk