memory leaking with gtk_menu_new



In checking my app with memprof I'm seeing a memory leak of 176 bytes whenever I close a window which has an associated popup menu.

Can anyone tell me what I'm doing wrong?

I'm creating the menu with

GtkWidget *popup = gtk_menu_new();

and adding items with

GtkWidget *item;
item = gtk_menu_item_new_with_label("whatever");
gtk_menu_shell_append(GTK_MENU_SHELL(popup), item);

Then when the "parent" window is closed, I'm doing

gtk_widget_destroy(popup);

I put in some printfs to verify that the "destroy" is being performed, and on the same address returned by the initial gtk_menu_new().

Memprof gives this trace:

Leaked 0x82765f8 (176 bytes)
calloc()
g_malloc0(): /usr/src/gtk/glib-2.4.4/glib/gmem.c:154
g_type_create_instance(): /usr/src/gtk/glib-2.4.4/gobject/gtype.c:1575
g_object_constructor(): /usr/src/gtk/glib-2.4.4/gobject/gobject.c:1044
g_object_newv(): /usr/src/gtk/glib-2.4.4/gobject/gobject.c:941
g_object_new_valist(): /usr/src/gtk/glib-2.4.4/gobject/gobject.c:984
g_object_new(): /usr/src/gtk/glib-2.4.4/gobject/gobject.c:826
gtk_menu_new(): /usr/src/gtk+-2.4.4/gtk/gtkmenu.c:1105
# and from my app...
catch_spreadsheet_click(): ../../gui2/ssheet.c:581

--
Allin Cottrell
Department of Economics
Wake Forest University, NC



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