Re: Glib::Variant leaks



On Tue, 2012-11-06 at 15:11 -0800, Andrew Potter wrote:
> Is anybody actually using the glibmm variant stuff? I'm serializing a
> complex variant and end up losing ~30 megabytes every time [1]
> 
> 
> I'm on Gtkmm 3.4, but I've run this test case in jhbuild:
> 
> 
> #include <glibmm/variant.h>
> 
> 
> int main() {
> {
> std::vector<gint64> ints;
> ints.push_back(2);
> Glib::VariantContainerBase vints = Glib::Variant< std::vector<gint64>
> >::create(ints);
> ints.clear();
> }
> 
> 
> return 0;
> }
> 
> 
> Valgrind reports:
> ==2369== LEAK SUMMARY:
> ==2369==    definitely lost: 2 bytes in 1 blocks
> ==2369==    indirectly lost: 0 bytes in 0 blocks
> ==2369==      possibly lost: 4,032 bytes in 7 blocks
> ==2369==    still reachable: 5,595 bytes in 14 blocks
> 
> 
> Am I not supposed to call ::create() like this?

No, that should be no problem.  There was a reference counting problem
due to some newly added code that forgot to remove some extra
referencing that would have been necessary without the new code.  This
commit should fix it:

http://git.gnome.org/browse/glibmm/commit/?id=5596d9f3ddca6942d632c85f1cbed475e0a766a8

Thanks for catching this.
> 
> 
> Thanks.
> 
> 
> [1] https://github.com/talisein/Horizon/blob/master/src/image_cache.cpp
> ImageData::get_variant()
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list

-- 
José



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]