[pygtk] Re: Pixbuf memory leak?
danny.milo at gmx.net
Tue Nov 29 03:54:07 WST 2005
Am Mittwoch, den 16.11.2005, 09:06 +0000 schrieb Loris Caren:
> On Tuesday 15 November 2005 21:06, you wrote:
> > I'm doing a large number of calls to
> > p = gtk.gdk.pixbuf_new_from_file(f)
> > ...
> > del p
> > and am finding that the process consumes more and more memory as it
> > goes on. Should I expect the del to free up the memory used by the
> > loaded image, or is there some kind of 'close' call I need to be
> > invoking first?
> Think I've found the answer to this one in the archives. Various other
> people have reported a similar bug, but
> suggests it's an issue with the garbage collector. Adding an explicit
> gc.collect() after my del stops my memory usage wandering off the
> scale. This looks like a generic issue for anyone manipulating lots
> of large objects, and an easy trap for those that thought that python
> 'just did' memory allocation and one never need bother about it.
I'm also disturbed by this and I wonder if it is possible to have python
memorize the "virtual size" aswell, and then garbage collect using the
"virtual size" instead of the (real) size of the handle.
I think this should be brought to the attention of the developers of
python, since they should know best how to proceed.
Note that the "handle size < data size" problem would be a quite
universal problem (thinking about any python C extensions here)
More information about the pygtk