[Zope-dev] memory leak
Marco Nova
nova@tera-it.com
Thu, 12 Apr 2001 10:53:57 +0200
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C0C32E.1DA0FA98
Content-Type: text/plain;
charset="iso-8859-1"
I hope I hurt nobody attaching a 3 Kbyte zip file.
> -----Original Message-----
> From: Karl Anderson [mailto:karl@digicool.com]
>
> Dyon Balding <dyon@devcoder.com.au> writes:
>
> > On Tue, Apr 10, 2001 at 05:27:28PM +0200, Marco Nova wrote:
> > > Hello guys,
> > >
> > > It seems that I've some memory leak problems and I want
> to understand where
> > > I've to look for.
> > >
> > > Scenario:
> > >
> > > I've an IIS web server that generates an XML page (taking
> data from
> > > SqlServer);
> > > The Zope web server must retrieve the XML page, manage
> the data and render
> > > them in HTML (I cant only apply a XSL stylesheet to XML).
> > >
> > > The Facts:
> > >
> > > I've written a external method that - using httplib -
> reads the XML page and
> > > return a string that is the raw XML sources, than I've
> written another
> > > external method that use ExpatBuilder of
> Products.ParsedXML.DOM to parse the
> > > XML an generate a list of [(id - {mapping})] which will
> be accessed with a
> > > dtml-in tag, so in the sequence-key I've access to the ID and with
> > > sequence-item I can access to the mapping object.
>
> Are you parsing the XML and creating this list from the DOM objects,
> and then throwing them away? Or are you parsing the XML and creating
> this list from your pyexpat interface code, and never accessing the
> DOM objects?
I'm not sure, I think that the ExpatBuilder creates the DOM tree which I use
for gather information for my list (look at tarkresults.py in the attacched
zip file).
> In either case, it seems like you shouldn't be using ParsedXML's
> ExpatBuilder, which is an interface to PyExpat which is made to create
> ParsedXML's DOM objects. You should be using your own PyExpat
> interface to parse this information from your XML input, without the
> overhead of generating a DOM tree that you're just going to throw
> away. The interface is documented in the XML-SIG topic area on
> python.org, and our ExpatBuilder should be a good example on how to
> interface with our PyExpat installation - just don't build the DOM if
> you don't use it.
Ok, I will try, thanks.Anyway if my code is correct we have some bugs around
Zope or ParsedXML that could be of help for someother.
> Regardless of what you *should* be doing :), or if I'm misreading you,
> if you aren't keeping references to the DOM objects being created,
> then they should be reclaimed by the GC, and you do seem to have DOM
> objects lying around. I'd like to see your code, is it short enough
> to post? Or you can chuck it into the collector or ParsedXML tracker.
>
> For debugging purporses, I'd suggest simplifying by supplying an XML
> string directly, rather than from an external server.
Attached you will find a zip file containing:
- res.xml, an xml file generated by my web server, you should import it as a
dtml document named res;
- tarkresults.py, an external method (id:process_results,
modulename:tarkresults, functionname:process_results);
- check_qs.dtml, a dtml method (id:check_qs);
- grid_view.dtml, a dtml method (id:grid_view);
- grid_page.dtml, a dtml method (id:grid_page);
then accessing to grid_view, you should be able to reproduce the behaviour.
Best Regards,
- mn
------_=_NextPart_000_01C0C32E.1DA0FA98
Content-Type: application/octet-stream;
name="tarkresults.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="tarkresults.zip"
UEsDBBQAAAAIAEhGiyoGPc5wVQMAAPcLAAAOAAAAdGFya3Jlc3VsdHMucHmdVlFr2zAQfg/kP4jm
wQ4NptvYS1kGGzVj0CalK6NQilEsOdXm2EaSQ7ux/76TLMly4rhpH+LIku7uu9N9n5zxcoP+XC6/
IbapSi4RDGcovrlZ3oxHmVq85iWpUymia8wFJXdXl9HF8spuj58qLL/WLCeUj0fjEaEZ4lRyRrc0
KUpCE0mfZFiufk3PxyOEspIjNY1YgWAySh/BdAETQi8jxDK9HqnH7XNF0XyuN97Gd7fJYnkRnyv/
NS/abT9xXlNlbRaCQCGZKCgVL1MqRMKpqHMJf2nJSaiMZogRBWmC0OaZsFSiOfr7z3u/DxgJHmCW
ET2rkIN9YtHr8B34E4Pf7urk4Cbjy/gqXphcjFHXTOL1Am90kDAoYBTMUAAhUs4qycpCvRalpCKY
tg4c7F03KoWeE2lzmTofND8IQ5Q1TzWQtKyeOVs/SvWy5mVdqYGQWNYiQMcgOrWVdQtrKr9IgLiq
JQ3V6kuYoKBBVa9ylmJdkZ6o/vor4rX2lLCXbc2mXgceAIIlHXKj149KmmT9yWL5OBSg5rnzP6EF
g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