[pygtk] PyGObject leaking?

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Tue Apr 10 07:07:31 WST 2007


On Seg, 2007-04-09 at 18:49 -0400, Mario Beauchamp wrote:
[...]
> 'exiting' is print before my 'dispose' and 'finalize' statements and not after
> as I expected.
> 
> I thought that as soon as run() would return, data would go out of scope, its
> Python ref count would drop to 0, the PyGObject would be freed and release the
> underlying gobject which would be then disposed and finalized... all this
> before the 'exiting' line.
> 
> Am I missing something here? Is my reasonning correct? Or is this a bug?

  See http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq08.004.htp

> 
> This is really an important matter for me since the real gv extension module is
> required by both software packages I am developing (OpenEV and CIETmap). And
> this is definitely a release stopper...

  You should not ever rely on Python objects being freed immediately as
they go out of scope.  Yes, PyGObject exacerbates the problem a bit more
than it should, but  Python itself doesn't guarantee timely garbage
collection; it just so happens that reference counting ensures garbage
collection is often right after a reference going out of scope, but not
always.

> 
> Thank you.
> 
> cheers
-- 
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic



More information about the pygtk mailing list