[ 
https://issues.apache.org/jira/browse/XERCESJ-1573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414743#comment-13414743
 ] 

Mukul Gandhi commented on XERCESJ-1573:
---------------------------------------

Hi Jorge,
    After your latest report, I did analyzed the java heap dump while running 
the jaxp.SourceValidator tool with your example validation having <assert> and 
with 1000000 iterations.

It seems, that the way class PSVIElementNSImpl is managed in 
XMLAssertPsychopathXPath2Impl.java is causing lot of objects of 
PSVIElementNSImpl to be alive during validation.

In the following code fragment of XMLAssertPsychopathXPath2Impl.java,
 
public void startElement(QName element, XMLAttributes attributes, Augmentations 
augs) throws Exception {
        
    if (fCurrentAssertDomNode == null) {
        fCurrentAssertDomNode = new PSVIElementNSImpl((CoreDocumentImpl) 
fAssertDocument, element.uri, element.rawname);
        fAssertDocument.appendChild(fCurrentAssertDomNode);
    }  

    ...

}


the object creation with the call, "new PSVIElementNSImpl(...)" is perhaps the 
pain point for memory usage. Your report 
https://issues.apache.org/jira/secure/attachment/12536525/mem.png also points 
to a similar analysis.

It seems, that this malady is felt only when you stress the validator to a 
point like 1000000 iterations. A repetition like 100, 1000 or 10000 works 
nicely for me.

Here are some of my final thoughts related to this bug report,

1) It's just too risky to change the logic of call startElement(...) of 
XMLAssertPsychopathXPath2Impl.java (of the areas of code I've pointed above) -- 
if this is really the pain point after my quick analysis. These parts of Xerces 
<assert> validator are the foundation of our assertions implementation. It may 
be doable to optimize these code paths, but that would require careful thought.

2) Perhaps a usage of <assert> is not suitable for a stress situation like 
you've mentioned. Or you may perhaps restructure your validation program, to 
take out assertions to another layer of your application.

3) This may be a issue of using <assert> via the jaxp.SourceValidator tool. If 
you can implement an application reset at a user layer, instead of expecting 
Xerces to do optimizations for this case, that might also help.



Thanks,
Mukul
                
> Possible memory leak when using assertions
> ------------------------------------------
>
>                 Key: XERCESJ-1573
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1573
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Datatypes
>    Affects Versions: 2.11.0
>            Reporter: Jorge L. Williams
>            Priority: Blocker
>         Attachments: d1.png, d2.png, d3.png, d4.png, d5.png, d6.png, 
> duration-sans-assert.xsd, duration.xsd, good.xml, mem.png
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to