[EMAIL PROTECTED] wrote:
> 
> I am processing 80 XML messages per second and I am encountering
> OutOfMemory problem, and I have two questions.
> 
> 1. I create and delete XercesDOMParser for each message. This may not be
> efficient but I do not know how the memoy management is working internally
> by reusing a parser. Is the memory keep increasing by reusing a parser ?
> How do I release the previous message related memory?
In general, using the DOM is not as efficient as using SAX-based parsing.
You can certainly re-use a XercesDOMParser instance, but it might not help
that much

> 
> 2. Everytime I create a new XercesDOMParser, it seems to need a chink of
> memory. XMLReader inside of XercesDOMParser requires about 164KB. After
> prcessing about 500K messages, OS generates OutOfMemory exception while my
> process is using about 650MB only. Why does this happen? My guess is that
> there is memory fragmentation and OS cannot find 164KB of continous memory
> space. How can I avoid this problem?
Are you sure your application isn't leaking memory somewhere?  Normally,
memory for a DOM instance is allocated in large blocks, so fragmentation
should not be a problem.  It might be, however, if your code is leaking.

Dave

Reply via email to