Need help to understand garbage collection

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Oct 6 23:36:42 EDT 2007


En Sat, 06 Oct 2007 14:16:36 -0300, David Tremouilles  
<david.trem at gmail.com> escribi�:

> I would need help to understand how garbage collection work and how to
> "trace" objects...
> In the example below an object is created and deleted.

Not exactly: an object is created and bound to the name "a". Some code is  
executed... Later, the name "a" is removed; the object's reference count  
is decremented, but the object itself can only be removed when the r.c.  
goes to zero.

> Why in the second part of the example I do not see any object removed:

Because you still hold a reference to the object.

-- 
Gabriel Genellina




More information about the Python-list mailing list