This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 101103 - XMLUtil.builerTL leaks large XML documents
Summary: XMLUtil.builerTL leaks large XML documents
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords: PERFORMANCE
: 85446 (view as bug list)
Depends on:
Blocks: 98168
  Show dependency tree
 
Reported: 2007-04-16 09:36 UTC by Petr Nejedly
Modified: 2010-04-13 18:44 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2007-04-16 09:36:32 UTC
There is a cache of DocumentBuilders in XMLUtil, using ThreadLocals.
This cache should speed up DOM parsing, but it seems it can also leak last parsed
document for each thread and builder setup.

The sample reference chain is:
jaxp.DocumentBuilderImpl.domParser->
...parsers.DOMParser.fDocumentSource->
...dtd.XMLDTDValidator.fDocumentSource->
...impl.XMLDocumentScannerImpl.fDTDDecl->
...util.XMLStringBuffer.ch->
char[<maybe really big>]

This issue is best manifested from Plugin Manager which parses really large
module catalogs, so the leak can be in order of megabytes.
Comment 1 Antonin Nebuzelsky 2007-05-10 22:16:46 UTC
Petre, please do evaluation of the leak.
Comment 2 Petr Nejedly 2007-07-02 16:02:35 UTC
There is a reset() method on the DocumentBuilder, but it is useless in the apache's impl, as it doesn't delegate to the
inner DOMParser's reset() method and the builder doesn't allow access to the parser instance.
I had to resort to no caching of DOM parsers.

Whoever needs to do bulk DOM Parsing, they should cache a parser themselves and free it once the bulk block is done.

openide/util/src/org/openide/xml/XMLUtil.java,v1.15
openide/util/test/unit/src/org/openide/xml/XMLUtilTest.java,v1.10
Comment 3 Jesse Glick 2007-07-09 17:48:06 UTC
Bummer.

Did you file a bug for Xerces?
Comment 4 Petr Nejedly 2007-07-23 12:59:59 UTC
No, I didn't. I guess it is supposed to call inner reset(), but I wasn't sure. and the documentation was not clear
either IIRC.
Comment 5 Jesse Glick 2010-04-13 18:44:20 UTC
*** Bug 85446 has been marked as a duplicate of this bug. ***