RE: [Zope-dev] memory leak
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
participants (1)
-
Marco Nova