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

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

 



There's a few bugs here. First, you forgot to unref the builder, which keeps a reference to all its objects. Second, windows must be destroyed with gtk_widget_destroy to ensure they are properly cleaned up. Windows, as toplevel widgets, need to interact with the windowing system at any time, even if you unreffed them.

On May 8, 2015 2:25 AM, "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?

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

_______________________________________________
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