Re: Nevow flat improvement

Jean-Paul Calderone <[email protected]> Tue, 7 Mar 2006 23:35:30 -0500
Newsgroups gmane.comp.python.quotient.dev
Message-ID <20060308043530.6122.718428084.divmod.quotient.13862@ohm>
On Tue, 7 Mar 2006 22:13:56 -0500, Jean-Paul Calderone <[email protected]> wrote:
>On Tue, 7 Mar 2006 13:52:27 -0800, John Benediktsson <[email protected]> 
>wrote:
>>
>>I found an improvement that can be made to nevow/flat/twist.py.
>>
>>It doesn't look like divmod.org accepts anonymous tickets, so I am
>>posting this here.
>
>Registration is open to all users.  You should see a "register" link near 
>the top-right of the screen.  Registration is required so that we can follow 
>up on all bug reports.
>>
>>The definition of deferflatten() causes cyclic references that force a
>>user to use the garbage collector to clean references to contexts
>>(PageContext, JavascriptContext, etc.) as well as other data referenced
>>by those contexts.
>>
>>Any recursive inner function is self referencing and cannot be collected
>>by reference counting.
>
>True.  But it should be collectable by the cyclic garbage collector, so long 
>as no object involved in the cycle defines __del__.  So this is a bug in 
>CPython.  Still, I suppose Nevow should work around it until someone fixes 
>it for real. ;)

Actually, I made a mistake when trying to verify this.  They *are* collectable by the cyclic garbage collector.  So they won't leak memory unless an object with a __del__ gets involved in the cycle somehow.

Jean-Paul