Re: [Zope-dev] RE: Memory Leak Question

2005-11-22 Thread Jim Fulton

Dan Pozmanter wrote:

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++;
}
"


Wrapper_findattr (like, for example, PyObject_GetAttr) returns a
*new* reference to the result of the attribute access.  So this would,
of course, cause a leak.  If you have code that is calling Wrapper_findattr
and not taking care of the new reference, then it is not surprizing that
you have a leak.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] RE: Memory Leak Question

2005-11-07 Thread Dan Pozmanter
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:[EMAIL PROTECTED] 
Sent: Monday, November 07, 2005 3:30 PM
To: Dan Pozmanter
Cc: zope-dev@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:[EMAIL PROTECTED]
> Sent: Monday, October 31, 2005 10:33 PM
> To: Dan Pozmanter
> Cc: zope-dev@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   [EMAIL PROTECTED]
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: Memory Leak Question

2005-11-07 Thread Florent Guillaume
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:[EMAIL PROTECTED] 
Sent: Monday, October 31, 2005 10:33 PM

To: Dan Pozmanter
Cc: zope-dev@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   [EMAIL PROTECTED]
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )