Re: Repost question from 2013. I have same problem.

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

 



I am using valgrind into it. I got leaks only in 2 cases (repeated variously):

==19790==    by 0x5398314: gtk_label_init (gtklabel.c:1341)
==19790==    by 0x5D84506: g_type_create_instance (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D683B6: g_object_new_internal (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D6A154: g_object_new_valist (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D6A47B: g_object_new (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x53C5E3E: gtk_menu_item_ensure_label (gtkmenuitem.c:2512)
==19790==    by 0x53C5E88: gtk_real_menu_item_get_label (gtkmenuitem.c:1881)
==19790==    by 0x53D05E7: gtk_model_menu_item_set_text (gtkmodelmenuitem.c:246)
==19790==    by 0x53D05E7: gtk_model_menu_item_set_property (gtkmodelmenuitem.c:447)
==19790==    by 0x5D6B1FA: g_object_set_property (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D5EC05: on_source_notify (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D5FF51: g_object_bind_property_full (in /usr/lib/libgobject-2.0.so.0.4400.0)

and this:
==19790==    at 0x4C2C080: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19790==    by 0x5FF26F1: g_malloc0 (in /usr/lib/libglib-2.0.so.0.4400.0)
==19790==    by 0x5D620A4: g_closure_new_simple (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D63561: g_cclosure_new (in /usr/lib/libgobject-2.0.so.0.4400.0)
==19790==    by 0x5D7AD00: g_signal_connect_data (in /usr/lib/libgobject-2.0.so.0.4400.0)
What does it means?

On Fri, May 8, 2015 at 5:02 PM, Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:
Hi;

On 8 May 2015 at 10:25, Konstantin P. <ria.freelander@xxxxxxxxx> wrote:
> The following code spawns a window --
>
> if (connect_build_object != NULL) {
>     g_object_unref (G_OBJECT ( connect_build_object ));
>     object = NULL;
> }
>     connect_build_object = gtk_builder_new();
>
> gtk_builder_add_from_resource ( connect_build_object,
> "/erg/app/ui/main_window.ui", NULL );
>
>     gtk_builder_connect_signals ( connect_build_object, NULL );
>
> connect_window = GTK_WIDGET ( gtk_builder_get_object ( connect_build_object,
> "connec" ) );
>
>     gtk_widget_show ( connect_window );
>
> Where connect_build_object is a global variable.
>
> Before spawning, it's checked if connect_build_object is initilized, if
> that's the case, its destroyed by g_object_unref.
>
> Closing the window calls the default handler.
>
> Problem: Each time I open and close a window, memory usage increases.
> And it does not decreases after builder unref.
>  Why it is increases, and how I can avoid this?

You cannot use `top` or pmaps to measure memory usage.

GTK+ (through GLib) uses an internal slab allocator, which means that
memory is allocated in bulk and then recycled internally.

If you want to check if there are leaks in your code, you should use
Valgrind instead, after reading this wiki page:

  https://wiki.gnome.org/Valgrind

Ciao,
 Emmanuele.


--
https://www.bassi.io
[@] ebassi [@gmail.com]

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux