[ 
https://issues.apache.org/jira/browse/XERCESJ-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan Tošovský updated XERCESJ-1653:
----------------------------------
    Attachment: 1653-cleanup.patch

To clarify my comments, I discussed here decreasing the overall memory usage 
when validating the content.

The observed leak itself is caused by running gc() in the test method too soon, 
before unloading the XMLDTDValidator (QName array cannot be cleared yet). I 
tend to mark this issue as invalid.

To improve this behavior a dedicated cleanup could be performed in the 
endDocument() method, see my patch. After applying the patch it is necessary to 
update also update SAXMemoryUsage.java so that the gc() is executed in the 
overridden endDocument method instead of endElement method.

> Memory leak with validating SAX Parser
> --------------------------------------
>
>                 Key: XERCESJ-1653
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1653
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: SAX
>    Affects Versions: 2.11.0
>         Environment: Windows 7 Enterprise, JDK 1.8.0_25
>            Reporter: Sebastian Millies
>            Priority: Critical
>         Attachments: 1653-cleanup.patch, 1653-map.patch, elemlist.dtd, 
> SAXMemoryUsage.java, SAXMemoryUsage.log, _subelem.dtd
>
>
> I'm parsing a very large XML file with org.apache.xerces.parsers.SAXParser 
> and validation turned on. The file contains 25 million elements of the form 
> specified in the attached DTD's, in total it is ca. 7 GB large. 
> Heap monitoring with jvisualvm shows millions of QName instances being cached 
> and not being garbage collected.
> Turning off validation makes the problem disappear. 
> I have tested a numer of other parsers (Crimson, Aelfred2, Resin, Woodstox). 
> With Woodstox, for example, I can process my 7 GB file (including validation) 
> with just 64MB of heap. With Xerces, 1024MB of heap do not suffice. 
> I'll attach a small diagnosis program (SAXMemoryUsage.java) that shows that 
> Xerces heap consumption increases inordinately.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to