If the SymbolTable keeps growing and growing in size it's probably a sign
the documents you're parsing contain many unique/random element and
attribute names. See the previous discussion on this subject here [1].

Recent releases of Xerces come with a new parser configuration (see
SoftReferenceSymbolTableConfiguration [2]) which uses a memory sensitive
SymbolTable. The internalized strings stored in this SymbolTable are softly
reachable and may be cleared by the garbage collector in response to memory
demand. Perhaps this might help you.

Thanks.

[1] http://marc.info/?t=111099151200003&r=1&w=2
[2] http://xerces.apache.org/xerces2-j/faq-xni.html#faq-3

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

"Brian" <[EMAIL PROTECTED]> wrote on 02/28/2008 02:30:10 AM:

> I have implemented a parser pool (that is using a DOMParser via
> DocumentBuilder and DocumentBuilderFactory) java 1.4 and it seems to me
that
> based on the memory profile that DOMParser is not meant to be pooled and
> leaks memory (seems like symbol table, int[] variables not cleaned up).
My
> implementation guarantees that only one thread has a parser instance at
any
> time, but it can be released and reused by another thread again and
again.
> The issue is that the memory seems to grow and grow, and I have profiled
the
> test with and without my pool implementation.  Based on that it appears
that
> DOMParser cannot be cached (pooled), or the memory will leak over the JVM
> life.
>
> My pool is using the DocumentBuilder API (stored in the pool and checked
out
> and returned synchronously) to get the parser instance and then caching
that
> in the pool.  There is no "reset" method of DocumentBuilder (in Java
1.4),
> which was introduced in java 1.5 and that indicates that it should be
called
> to "allow the reuse of existing DocumentBuilders" (e.g. DOMParser's) -
but
> this method doesn't exist in 1.4.
>
> So is this a known limitation or has anyone else had issues with memory
leak
> "OutOfMemory" errors when using DOMParser pools?
>
> No virus found in this outgoing message.
> Checked by AVG.
> Version: 7.5.516 / Virus Database: 269.21.1/1301 - Release Date:
2/27/2008
> 8:35 AM
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to