[Python-Dev] Garbage collecting closures

Jeremy Hylton jeremy@zope.com
14 Apr 2003 17:51:23 -0400


On Mon, 2003-04-14 at 17:41, Paul Prescod wrote:
> Yes, now that I know to try it, gc.collect() would have fixed the problem.
> 
> But I'm not sure where I would have learned to do so. The documentation 
> for __del__ is out of date.
> 
>   * http://www.python.org/doc/2.3a2/ref/customization.html
> 
> The documentation lists a variety of reasons that __del__ might not get 
> called (it doesn't claim to be exhaustive but it does list some cases 
> that I consider pretty obscure). It doesn't list nested recursive functions.

The first one on the list is "circular references between objects." 
(Now that should be "among" objects, but that's not your complaint.) 
Nested recursive functions are an example of data structure involving
circular references.

Jeremy