Hi.
I've been experimenting with libglade from Python, and have found that I
can use up an awful amount of memory incredibly quickly by destroying
and re-creating widgets. I've written a small script that demonstrates
it.
There is a small window with a label and a button on it. When you click
the button the label gets replaced repeatedly with a new copy. It's the
while loop in the recreate_label() function that does the replacement,
and causes the memory gobbling.
#!/usr/bin/env python
#
# $Id$
import gtk, libglade, time
def recreate_label(signal, label, vbox):
label.destroy()
while 1:
wtree = libglade.GladeXML("project1.glade", "label")
label = wtree.get_widget("label")
vbox.pack_start(label)
vbox.reorder_child(label, 0)
label.destroy()
if __name__ == "__main__":
wtree = libglade.GladeXML("project1.glade", "window1")
window = wtree.get_widget("window1")
button = wtree.get_widget("button")
button.signal_connect("clicked", recreate_label,
wtree.get_widget("label"),
wtree.get_widget("vbox1"))
window.show()
gtk.mainloop()
If anybody would like the Glade file that goes with it to play around,
drop me a line and I'll post it. It's only short.
So my question is - am I doing something wrong (most likely), or is this
a leak? I'm using the latest stable pygnome (i.e. on GNOME 1.4), with
Python 2.2, all compiled from source.
Thanks.
--
Graham Ashton
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/