Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

DOMParser memory leaks

Thread view: 
byoder@hotmail.com - 28 Feb 2008 03:09 GMT
I have implemented a parser pool (that is using the DOMParser via
DocumentBuilder and DocumentBuilderFactory) java 1.4.2 and it seems to
me that based on the memory profile that DOMParser was not meant to be
pooled and leaks memory (int[] variables are not cleaned up).

My pool is using the DocumentBuilder API to get the parser instance
and then caching that in the pool.  There is no "reset" method, which
was introduced in java 1.5 and that indicates that it should be called
to "allow the reuse of existing DocumentBuilders" - but this method
doesn't exist in 1.4.2.

So is this a known limitation in 1.4.2  or has anyone else had issues
with memory leak "OutOfMemory" errors when using parser pools?

Thanks,

-BY
Mike Schilling - 28 Feb 2008 03:20 GMT
> I have implemented a parser pool (that is using the DOMParser via
> DocumentBuilder and DocumentBuilderFactory) java 1.4.2 and it seems
[quoted text clipped - 5 lines]
> My pool is using the DocumentBuilder API to get the parser instance
> and then caching that in the pool.

Don't do that.  Seriously, there's no real advantage in it, and you
can see the disadvantages.
byoder@hotmail.com - 28 Feb 2008 07:07 GMT
On Feb 27, 7:20 pm, "Mike Schilling" <mscottschill...@hotmail.com>
wrote:
> byo...@hotmail.com wrote:
> > I have implemented a parser pool (that is using the DOMParser via
[quoted text clipped - 9 lines]
> Don't do that.  Seriously, there's no real advantage in it, and you
> can see the disadvantages.

At this point I am inclined to agree with you.  When I started the
DOMParser pool it actually did appear to improve performance (based on
my memory profiler and use case), but if it leaks memory then it is
not a viable option.  The most frustrating thing is the lack of
documentation on this (xerces or apache) and that it doesn't clearly
say if the class cannot be shared by multiple threads and/or reused.
Thanks for the advice.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.