[Zope] External scripts objects memory not released ?
Jerome hebert
jbert@ifrance.com
Wed, 12 Jun 2002 11:01:58 +0200
At 21:40 11/06/2002, Dieter Maurer wrote:
>Jerome hebert writes:
> > Zope 2.4 on a Debian 2.2 linux server.
> > ...
> > socrate:~# memstat | sort -rn | more
> > 1958684k
> > 157416k: PID 14967 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14966 (/opt/Zope-2.4.0-linux2-x86/bin/python)
>Your Zope uses 157 MB. This is not yet something, you need to worry about.
>
>Under Linux, threads are implemented by processes. However, they
>share the memory. All Zope processes/threads together use
>157 MB, not each one of them.
Still 157 MB is too much for a Zope server with so few hits.
There must be something wrong. When I start Zope, it only takes a few
MB of memory, going to more than one hundred is not acceptable.
If Zope is not able to use less memory, I will have to stay with Apache
and Perl. But more likely the problem is coming from my setup because
I'm new to Zope and Python so perhaps I certainly haven't done the right
thing.
One possibility I see is that the problem is coming from my external methods.
I have an external method doing SOAP request (using the SOAP.py module)
and I use a dump python class around the returned SOAP objects to
avoid the problem of security exception when accessing the SOAP
objects in DTML.
Possibly the SOAP objects are never destroyed by Zope and this
would explain why Zope continuously grows in memory.
Can someone explain how the object returned from external scripts
are destroyed by Zope after the HTTP request has been completed ?
Below is an extract of my external method:
# get_objects() IS THE EXTERNAL METHOD CALLED FROM DTML
class somp:
""" A class to access SOMP Agent"""
__allow_access_to_unprotected_subobjects__ = 1
def get_objects(self, type='', id='', status='',
options={'attributes':''}):
""" get objects"""
rt = []
self.somp = SOAP.SOAPProxy(self.proxy, unwrap_results = 0,
namespace = self.namespace )
objects = self.somp.get_objects(type=type, id=id, status=status,
options=options)
for object in objects:
sop = sompobject(object)
sop.somp = self.somp
rt.append(sop)
return rt
# DUMP PYTHON CLASS AROUND SOAP OBJECTS
class sompobject:
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self, object):
self.__allow_access_to_unprotected_subobjects__ = 1
self.object = object
def __getattr__(self,name):
try:
return self.object[name]
except AttributeError:
try:
return self.object['attributes'][name]['value']
except AttributeError:
raise AttributeError, "Was Asking for attribut " + name
Regards,
Jerome.
At 21:40 11/06/2002, Dieter Maurer wrote:
>Jerome hebert writes:
> > Zope 2.4 on a Debian 2.2 linux server.
> > ...
> > socrate:~# memstat | sort -rn | more
> > 1958684k
> > 157416k: PID 14967 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14966 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14965 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14964 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14963 (/opt/Zope-2.4.0-linux2-x86/bin/python)
> > 157416k: PID 14692 (/opt/Zope-2.4.0-linux2-x86/bin/python)
>Your Zope uses 157 MB. This is not yet something, you need to worry about.
>
>Under Linux, threads are implemented by processes. However, they
>share the memory. All Zope processes/threads together use
>157 MB, not each one of them.
>
>
>Dieter
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif