This is the mail archive of the
guile-gtk@sources.redhat.com
mailing list for the Guile project.
gtk-container-children memory leak
- From: Kevin Ryde <user42 at zip dot com dot au>
- To: guile-gtk at sources dot redhat dot com
- Date: Sat, 25 Jan 2003 01:05:03 +1000
- Subject: gtk-container-children memory leak
I think gtk-container-children might be leaking memory. On a recent
i386 debian and my build of guile 1.6.1, the following little program
uses an apparently ever increasing amount of core (as shown by the
"top" program).
(use-modules (gtk gtk))
(define toplevel (gtk-window-new 'toplevel))
(gtk-container-add toplevel (gtk-label-new "foo"))
(while #t
(gtk-container-children toplevel))
I think gtk_container_children allocates a fresh GList for its return,
which the caller is supposed to free. As far as I can tell that
doesn't happen in gtk-glue.c etc.
Inserting a g_list_free manually into sgtk_gtk_container_children
seems to do the trick, but I'm not smart enough to tell how to get
that done properly.
It'd probably be good to allow either freeing or not.
gtk_container_children and a prospective gdk_list_visuals should free,
gtk_radio_button_group (which is a GSList) and a prospective
gdk_window_peek_children (implementing gtk-window-children) shouldn't.