[Zope-dev] RE: Memory Leak Question

Dan Pozmanter dan at siteworx.com
Mon Nov 7 16:09:42 EST 2005


Sure thing:

I was mucking around in _Acquisition.c with getattr, findattr, etc,
and I noticed checked to see if my code was leaky.
It was!  I then checked just vanilla code, and found the same
leak (only much much smaller).

So here is what I did to make things more visible:
In Wrapper_getattro, I simply added a while loop,
and another call to Wrapper_findattr before the return statement "
return Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 1, 0, 0);".
Loop it 1000 times for some fireworks, 5 times for a more modest
display.

Looping other calls (such as Wrapper_acquire before "    return
Wrapper_acquire(self, oname, filter, extra, orig, explicit, 
			   containment);" in Wrapper_findattr)
does not produce a similar leak.

So.  To reproduce:

Edit _Acquisition.c
Function Wrapper_getattro
add 
"    int i = 0;"
at the top.
then, if self->obj ... and all that, add:
"
while (i < xyz) {
Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 1, 0, 0);
i++;
}
"
where xyz is an integer of your choice.

Simply go to the index_html the root or any other object,
fire up task manager (I produced this bug on windows),
then refresh that page rigorously.

Note that this bug can be reproduced without modifying any code.
The loop simply amplifies the leak, making it easier to spot.
(Or the loop causes huge additional problems I am not aware of.
In any case, doing *something* clever to call Wrapper_findattr more than
once should make the problem easier to spot.)

_______________
 
Daniel Pozmanter
Siteworx, Inc.
 
"Festina Lente" - Gaius Julius

-----Original Message-----
From: Florent Guillaume [mailto:fg at nuxeo.com] 
Sent: Monday, November 07, 2005 3:30 PM
To: Dan Pozmanter
Cc: zope-dev at zope.org
Subject: Re: Memory Leak Question

Could you provide details about why you think there's a leak in the code
(what led you to Wrapper_findattr), and how to reproduce it consistently
on a blank platform (Zope 2.8.4 preferred)?

Maybe open a bug in the collector at
http://www.zope.org/Collectors/Zope/ also.

Thanks,

Florent

Dan Pozmanter wrote:
> Consider it reported then.
> (Sorry for the delay, I was out of the office for most of last week).
> 
> It looks like the problem is in Wrapper_findattr.
> 
> Any thoughts?
> 
> _______________
>  
> Daniel Pozmanter
> Siteworx, Inc.
>  
> "Festina Lente" - Gaius Julius
> 
> -----Original Message-----
> From: Chris McDonough [mailto:chrism at plope.com]
> Sent: Monday, October 31, 2005 10:33 PM
> To: Dan Pozmanter
> Cc: zope-dev at zope.org
> Subject: Re: [Zope-dev] Memory Leak Question
> 
> Nobody has yet reported a memory leak symptom against any particular 
> piece of Zope 2.8.X yet, AFAIK.
> 
> On Oct 31, 2005, at 6:34 PM, Dan Pozmanter wrote:
> 
> 
>>Ahoy,
>>
>>   I was poking around in _Acquisition.c, and noticed my memory usage 
>>spiked.
>>Returning to the vanilla code (2.8.2-final), I noticed the same spike 
>>(just less pronounced).
>>(If you refresh the page a few gazillion times this pops up).
>>
>>I would not categorize this as an actual bug report (I'd like to test 
>>more rigorously with a script to verify a leak), but after reading the
> 
> 
>>note on Changes for 2.8.x in the to do section, I was curious:
>>Is this a known issue?
>>
>>If so, has there been any headway, and can I be of any assistance in 
>>resolving it?
>>

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-Dev mailing list