On 8 Feb 2011, at 09:36, John Emmas wrote: > > int main (int argc, char *argv[]) > { > Gtk::Main *app = new Gtk::Main (&argc, &argv); > > delete app; > > return 0; > } > > The above code causes hundreds of memory leaks. >
I spent a few minutes on this (literally just a few) this morning, while I was sipping my first coffee and still trying to wake up! During gtk_init() I discovered a couple of places where g_strdup() gets used but the allocated memory never gets freed. For example in gdk/gdkinternals.h, the memory allocated to the variable '_gdk_display_arg_name' never gets properly freed (it gets freed if it needs to get reallocated but otherwise, it just leaks). I also discovered (although it wasn't relevant to my original post) that simply calling g_warning() results in about 15 memory leaks, although I didn't have enough time to find any of them. I don't know what to do about this. I remember from about a year ago that a guy was offering to track down memory leaks and if I could find some spare time over the next few months I'd be happy to assist in finding them, a few at a time if it would help - but even just that one line of code produces many hundreds of leaks, so I don't want to be wasting my time if they're just an inevitable part of the way gtk+ is structured. This seems like one of those tasks that could soon turn into a can of worms!! John _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list