Why do a gtk/directfb process grows bigger and bigger ?


I recently noticed the the size of a generic gtk/dfb application considerably grows over time while the same application, but compiled for gtk/x11, does not.

The attached example aplication permanently sets up a window and an external box and at every proram's iteration a textview is created, packed into the external box and then destroyed.

Compiling for gtk/x11, the total amount of memory allocated by the process remains constant, while under gtk/dfb the process image size grown of some tens of KB every 3 or 4 iterations.

I wonder what's the reason of this difference: am i doing something wrong when i gtk_widget_destroy() the textview ? Is gtk/dfb leaking somewhere ?


#include <gtk/gtk.h>
static void key_press_event( GtkWidget *widget, GdkEvent  *event, gpointer   data )
	gtk_main_quit ();

int main( int   argc, char *argv[] )
    GtkWidget *window, *box_external, *textview;
    GtkTextBuffer *textbuffer;
	int i=0;

    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    g_signal_connect_after (G_OBJECT (window), "key_press_event", G_CALLBACK (key_press_event), NULL);
    gtk_widget_set_size_request (window, 400, 300);

    box_external = gtk_vbox_new (TRUE, 0);
    gtk_container_add (GTK_CONTAINER (window), box_external);

	while (1) {

	    textview = gtk_text_view_new();
		textbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
		gtk_text_buffer_set_text (textbuffer, "Blah blah blah blah blah..", -1);

		gtk_box_pack_start (GTK_BOX(box_external), textview, FALSE, FALSE, 5);
	    gtk_widget_show_all (window);

		printf("Run %d\n", i);
	    gtk_main ();

		gtk_widget_destroy (textview);
    return 0;

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