Memory leak in gtk label?

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

 



Hi

	I am using valgrind to check my application, I found a lot of memory leak issue related to GtkLabel or maybe pango staff.

	I write a small test case to make it simple:

-----------------------------------------
#include <gtk/gtk.h>
void on_click(GtkButton *button, GtkWidget *textview)
{
        gtk_main_quit();
}

int
main(int argc, char* argv[])
{
        GtkWidget *window;
        GtkWidget *vbox, *button;
        GtkWidget *label;

        gtk_init(&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        vbox = gtk_vbox_new (FALSE, 0);
        gtk_container_add (GTK_CONTAINER (window), vbox);

        button = gtk_button_new_with_label("quit");
        g_signal_connect(G_OBJECT(button), "clicked",
                        G_CALLBACK(on_click), NULL);

        label = gtk_label_new("hello");

        gtk_box_pack_start (GTK_BOX(vbox), button, FALSE, FALSE, 5);
        gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 5);

        gtk_widget_show_all(GTK_WIDGET(window));
        gtk_main();
        return 0;
}
------------------------------------------

And run something like:

G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --leak-check=full 

to check this test case

And I got a lot of leak report in gtk_label_size_request function. Detail as attached.

Is there anything wrong I did here? Or I should use valgrind with more ENV settings? Can anyone help on this? 

Thanks

Best Regards,
Raymond Liu

Attachment: 1.log
Description: 1.log

#include <gtk/gtk.h>

void on_click(GtkButton *button, GtkWidget *textview)
{
	gtk_main_quit();
}


int
main(int argc, char* argv[])
{
	GtkWidget *window;
	GtkWidget *vbox, *button;
	GtkWidget *label;

	gtk_init(&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	vbox = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (window), vbox);

	button = gtk_button_new_with_label("quit");
	g_signal_connect(G_OBJECT(button), "clicked",
			G_CALLBACK(on_click), NULL);

	label = gtk_label_new("hello");

	gtk_box_pack_start (GTK_BOX(vbox), button, FALSE, FALSE, 5);
	gtk_box_pack_start (GTK_BOX(vbox), label, FALSE, FALSE, 5);

	gtk_widget_show_all(GTK_WIDGET(window));

	gtk_main();

	return 0;
}

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://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