You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by BERVOETS Wim <wi...@axa.be> on 2006/09/13 11:34:39 UTC

Pooling LSParsers for performance reasons

Hi all,
 
I would like to keep a pool of LSParsers objects which can be used by my
application for parsing XML.
I'm using Commons Pool for the implementation of the pool where I'm
using a BaseKeyedPoolableObjectFactory for creating the LSInputs,
LSOutputs, LSSerializers and LSParsers.
 
It works nicely and much faster as I don't have to create the parser
object anymore but I'm seeing that some memory is leaking on the
LSParsers. (it seems the xml document I parsed with it stays in memory
when I put back the LSParser object in the pool)
 
I guess this is normal because I couldn't find any sort of clear() or
reset() method on the LS* objects.
 
I would like to know if it's possible to add some kind of
clear()/reset() method on the LS* objects which I can call when I return
the LS* objects back to the pool ?
 
kind regards,
Wim Bervoets


-----Disclaimer-----

This message may contain confidential information intended solely for the use of the named addressee. If you are not the intended recipient, you should not read, use, disclose or reproduce the content of this message. If you have received this message by mistake, please notify the sender immediately. Any views or opinions presented in this message are solely those of the author and do not necessarily represent those of AXA Belgium, AXA Bank Belgium, AXA Tech Belgium GIE - ESV or any other entity of the AXA Group, unless otherwise stated by the sender and duly authorized by the said companies.

---------------------


Re: Pooling LSParsers for performance reasons

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
"BERVOETS Wim" <wi...@axa.be> wrote on 09/13/2006 05:34:39 AM:

> Hi all,
> 
> I would like to keep a pool of LSParsers objects which can be used 
> by my application for parsing XML.
> I'm using Commons Pool for the implementation of the pool where I'm 
> using a BaseKeyedPoolableObjectFactory for creating the LSInputs, 
> LSOutputs, LSSerializers and LSParsers.
> 
> It works nicely and much faster as I don't have to create the parser
> object anymore but I'm seeing that some memory is leaking on the 
> LSParsers. (it seems the xml document I parsed with it stays in 
> memory when I put back the LSParser object in the pool)
> 
> I guess this is normal because I couldn't find any sort of clear() 
> or reset() method on the LS* objects.
> 
> I would like to know if it's possible to add some kind of clear()
> /reset() method on the LS* objects which I can call when I return 
> the LS* objects back to the pool ?

The Xerces implementation of LSParser has a reset() method but it isn't 
part of the DOM interface. You won't need to call that though. I just 
modified Xerces' LSParser (and DocumentBuilder) so that they drop their 
internal references to the DOM they just built. This will make it into 
Xerces 2.8.1 which should be available some time tonight.

> kind regards,
> Wim Bervoets

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org