[OLPC-devel] Pygtk and garbage collecting
Philip Van Hoof
spam at pvanhoof.be
Mon Jul 31 11:32:57 EDT 2006
This PyGTK bug is going to be important for OLPC as it might slow down
object destruction.
http://bugzilla.gnome.org/show_bug.cgi?id=320428
For example in the tinymail-python-test.py*, you will find a
gc.collect(). This is to speed up the destruction of objects in the
situation described in Bug #320428
https://svn.tinymail.org/svn/tinymail/trunk/libtinymail-test/tinymail-python-test.py
In case of tinymail the GtkTreeModel that holds a reference on all the
headers of the current folder, is such an object.
model = MsgHeaderListModel ()
treeview.set_model (model)
newmodel = MsgHeaderListModel ()
treeview.set_model (newmodel)
Will not immediately mark "model" for garbage collection (when model
goes out of scope). Adding a gc.collect(), however, will.
That model instance, in case of tinymail, holds a reference to the
headers of your folder. This is where most of the memory tinymail
consumes is located (the summary information). Therefore it's a small
disaster on a device with few memory resources, that Pythons garbage
collector is slow at detecting this.
Applying the patch of Bug #320428 or performing gc.collect() in your
Python code fixes this.
Note that tinymail isn't going to be the only case.
--
Philip Van Hoof, software developer at x-tend
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
work: vanhoof at x-tend dot be
http://www.pvanhoof.be - http://www.x-tend.be
More information about the Devel
mailing list