A Ter, 2004-02-17 �s 00:49, Arturo Gonz�lez escreveu:
> I'm having a memory leak somewhere when refreshing the content of a
> HBox. I'm not doing it in a optimized way, i know, but i want to find
> where is the error. To remove all the content, I did:
> 
>  for i in (self.box.get_children()):
>                 self.box.remove(i)
> 
> Then i pack again all the elements (some have changed) in the box.
> 
> I suppose that, if no references are found to self.box's childrens, they
> are garbage-collected :P, aren't they? 

  Yes... eventually!  There has been change a few months ago with the
way pygtk does memory management.  Before that change, objects would be
freed as soon as the reference count dropped to zero.  Now, however,
when an object loses all external references it is handed over to
Python's cyclic garbage collector.  The GC doesn't free objects right
away.  It only does its work periodically or when certain thresholds are
reached.  I suggest you look at the documentation for module gc for more
information on this.  For example, you can explicitly tell the gc to run
at any time, to free unreference objects.

  Otherwise, I looked at the pygtk wrapper code, but couldn't find any
memory leak in gtk.Container.get_children().

  Hope it helps.  Regards.

-- 
Gustavo Jo�o Alves Marques Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
The universe is always one step beyond logic.

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to