Is this a memleak in GTK ?



Hi,

I know that this annoy you, but I think we have to find a solution to
these problems. Here is a simple code (taken from helloworld.c) that
reports a lot of leaks. Additionaly, the results are random:

-------------------------------
Report 1 -------------------------------

GLib-INFO: 55071 bytes allocated

GLib-INFO: 15285 bytes freed

GLib-INFO: 39786 bytes in use

Report 2 -------------------------------

GLib-INFO: 54856 bytes allocated

GLib-INFO: 15266 bytes freed

GLib-INFO: 39590 bytes in use

Report 3 -------------------------------

GLib-INFO: 55053 bytes allocated

GLib-INFO: 15267 bytes freed

GLib-INFO: 39786 bytes in use

-------------------------------

This was generated by g_mem_profile compiled for 

        #define MEM_PROFILE
        #define MEM_CHECK
        #define ENABLE_MEM_PROFILE_EXCLUDES_MEM_CHUNKS

The code is attached. I just started the application and closed it. 

If I missunderstud the report of g_mem_profile, please correct me. I
would also appreciate some explanations on why does the result change.

TIA,

Ionutz
#include <gtk/gtk.h>

class MemReporter
{
public:
  MemReporter(){};
  ~MemReporter() { g_mem_profile(); }
};

static MemReporter m;

void destroy( GtkWidget *widget,
               gpointer   data )
{
  gtk_main_quit();
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    gtk_init(&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect (GTK_OBJECT (window), "destroy",
						 GTK_SIGNAL_FUNC (destroy), NULL);
    
    gtk_widget_show (window);
    gtk_main ();

    return(0);
}



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