[Zope] Tip: huge memory leak fixed (dtml and pythonscript)
kosh@aesaeion.com
kosh@aesaeion.com
Fri, 2 Aug 2002 03:52:07 -0600 (MDT)
On Fri, 2 Aug 2002, Jo Meder wrote:
>
> Hello everybody,
>
> after much gnashing of teeth and pulling out of hair we finally seem to
> have found the error in our ways. What we were doing led to a massive
> memory leak and I thought I'd let everbody know so you know what to
> avoid.
>
> Our setup is something like <dtml-document or method> calls
> <pythonscript> and <pythonscript> calls <restrictedTraverse> for some
> given <path>. The resulting <object> is then used to render some content
> and the resulting data is returned.
>
> Here comes the warning: If you don't explicitly set the <object>
> obtained by <restrictedTraverse> to <None> (maybe you could <del> it
> instead just as well) this <object> will be leaked with any
> <subobjects> instantiated along the way, namely a
> <ImplicitAcquirerWrapper> and (in our case) a <DateTime>.
>
I wonder if this is true for python products also. I will certainly look
into it and see if that is the case and if true that would certainly
explain some strange behavior I have been seeing. I have a fair number of
items that use restrictedTraverse and after zope has been running for a
while it seems those objects refs never go down but other items do.
Often my leaks do not seem as large but after long enough it gets fairly
large. My zope process will grow from 70M or so to 500M in a few weeks and
it seems to be all those objects refs which gets very high. Thanks a lot
for the tip.