[Zope-Coders] Re: [CMF-checkins] CVS: CMF/CMFCore - Skinnable.py:1.4

Shane Hathaway shane@zope.com
Fri, 28 Jun 2002 22:19:16 -0400


Florent Guillaume wrote:
> Shane Hathaway  <shane@cvs.zope.org> wrote:
> 
>>=== CMF/CMFCore/Skinnable.py 1.3 => 1.4 ===
>>+                        self._v_skindata = (REQUEST, sd, {})
> 
> 
> Isn't storing REQUEST in this _v_ attribute going to create huge
> circular references, or make things live too long ?

It won't create circular references--for that too happen, the request 
would have to hold a reference to the CMF site.  Here, the site refers 
to the request, not the other way around.  Even if that happened, most 
of the request gets explicitly cleared at the end of the publishing 
process, so the circular references would be broken right away.

The request won't live any longer than it does today.  The "sd" variable 
is a wrapped object that already quietly holds references to the objects 
all the way down to the root, including the request.  Since this 
attribute gets replaced on nearly every request, the effect is that the 
request data is held only slightly longer than the publishing process.

The _v_skindata attribute isn't a concern, but Python Scripts also have 
a volatile attribute that holds excessive references, and this one 
concerns me more.  "_v_f", when its func_globals is updated with the 
bindings, holds references to "context" and "container", both of which 
refer to a host of other Zope objects.  That would be fine if there 
weren't so many Python scripts!  Consequently, Zope probably keeps 
references to dozens of old, "gutted" requests and ghosted objects. 
Sometime that ought to be fixed.

Shane