Re: stress testing Xerces
[email protected] (Jason E. Stewart)
| Newsgroups | gmane.text.xml.xerces-p.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] (Jason E. Stewart) writes: > Brian Faull <[email protected]> writes: > > Depends on what you are doing - if it is DOM related, then yes, you > must tell the parser to release the memory, otherwise it grows. From > the API docs: > > void AbstractDOMParser::resetDocumentPool() > > Reset the documents vector pool and release all the associated memory > back to the system. > > When parsing a document using a DOM parser, all memory allocated for a > DOM tree is associated to the DOM document. > > If you do multiple parse using the same DOM parser instance, then > multiple DOM documents will be generated and saved in a vector > pool. All these documents (and thus all the allocated memory) won't be > deleted until the parser instance is destroyed. > > If you don't need these DOM documents anymore and don't want to > destroy the DOM parser instance at this moment, then you can call this > method to reset the document vector pool and release all the allocated > memory back to the system. As a note - if you create a new parser each time, this should *not* cause a leak: while (1) { my $parser = XML::Xerces::XercesDOMParser->new(); $parser->parse(XML::Xerces::MemBufInputSource->new('<test/>')); } if it does, that's a *big* problem, and I'd like to know about it. Cheers, jas.