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

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

 



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