Re: Nevow flat improvement

Anthony Baxter <[email protected]> Thu, 9 Mar 2006 00:04:19 +1100
Newsgroups gmane.comp.python.quotient.dev
Message-ID <[email protected]>
On Wednesday 08 March 2006 14:13, Jean-Paul Calderone wrote:
> On Tue, 7 Mar 2006 13:52:27 -0800, John Benediktsson 
<[email protected]> wrote:
> >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. ;)

It wasn't clear to me that this was in fact a bug in the CPython GC, 
or just a preference for the refcounting. 

> I'm curious how you noticed this.  At various points I've seen
> Nevow apps grow in memory size, but I've never noticed function or
> cell objects in gc.garbage when this happens, which is how this
> problem manifests.

That suggests that it's not a GC bug. It's possible there's some 
object involved that's not GCable, I guess. From memory, there's a 
whole pile of new GCable objects in Python 2.5 - it might be worth 
grabbing current svn and seeing if it's any better.

Anthony
-- 
Anthony Baxter     <[email protected]>
It's never too late to have a happy childhood.