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]

Reply via email to