[pygtk] PyGObject leaking?

Mario Beauchamp starged at gmail.com
Thu Apr 12 10:17:28 WST 2007


Hi folks.

On 4/11/07, Tony Nelson <tonynelson at georgeanelson.com> wrote:
> >http://openev.svn.sourceforge.net/viewvc/openev/trunk/src/pymod/gvobject.py?revision=6&view=markup
>
> Well, the rot may be deeper than that, inside pygobject or pygtk code. ;)
> (I can't make heads or tails of that code, sorry if I am slandering it.)

Which code? gvobject.py? Anyhoo, it's useless...

> Python will collect objects as soon as they become unreferenced.
> Immediately.

Well, it turns out it's not immediate. Someone told me that Python 2.4
does a collect every 700 deallocations (a value than can be tweaked
with gc.set_threshold, I think). And it makes sense: I see my
destroyed objects finally being freed when I do other stuff like
opening a new window. But it's still not fast enough in certain cases.

> There are GC tools to show you which objects are garbage.  Those are the
> objects that are in or are referred to by reference loops.

I finally found out that it was not a Python problem... I needed to
put a few g_object_unref's in my override file. Kinda like a sink().

> FWIW, it might help to try to recreate some of the problems in small test
> code of your own.

That's what I was trying to do with my wrapped barebone class and the
simple script but
it was too simple to be useful :)

Anyhoo, I made a lot of progress today, thanks all!

cheers
-- 
Mario B.


More information about the pygtk mailing list