On Thu, 1 Apr 2010 16:21:14 +0100 Chris Vine <[email protected]> wrote: > On Thu, 1 Apr 2010 13:41:53 +0200 > Fabian Jacquet <[email protected]> wrote: > > If I replace Glib::ustring by std::string, I don't have the memory > > leak. > > Even if you include the call to Glib::thread_init() when you only use > std::string? > > If so it must be related to a call to g_utf8_collate(): the > constructor Glib::ustring taking a string literal just calls the > constructor of std::string, so that can't be it, but the comparison > operator calls Glib::ustring::compare(), which calls g_utf8_collate().
Or if we are being entirely rigorous about it, just possibly when you construct a std::string object your compiler is dispensing with the copy constructor (which will be inline), as it is entitled but not required to do, but does not do this when constructing a Glib::ustring object (the constructor for which is not inline); and the copy constructor of std::string, called by the copy constructor of Glib::ustring, is leaking. This seems most unlikely but you could test for it by directly initialising the string (which in my opinion is better style anyway). Chris _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
