You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Richard Wheeldon (JIRA)" <xa...@xml.apache.org> on 2008/03/02 14:16:52 UTC

[jira] Commented: (XALANJ-2215) Extremely high memory usage (and OutOfMemory) when using EXSLT str:tokenize or str:split

    [ https://issues.apache.org/jira/browse/XALANJ-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574216#action_12574216 ] 

Richard Wheeldon commented on XALANJ-2215:
------------------------------------------

I got these numbers from hat, using the above tests with -Xmx256M. It looks to me like the DTM code is a likely culprit. The dangling document reference looks like a red herring - when I altered the code to use a fresh document each time I get similar behaviour.

Instance Counts for All Classes (including platform)
260559 instances of class org.apache.xml.dtm.ref.ExpandedNameTable$HashEntry
122050 instances of class int[]
121593 instances of class int[][]
104224 instances of class org.apache.xml.utils.SuballocatedIntVector
38534 instances of class java.lang.String
35526 instances of class java.lang.Object[]
34769 instances of class java.util.Vector
34757 instances of class org.apache.xml.dtm.ref.ExtendedType
23075 instances of class char[]
17420 instances of class java.util.Hashtable$Entry[]
17407 instances of class java.util.Hashtable
17372 instances of class org.apache.xml.dtm.ref.ExtendedType[]
17371 instances of class org.apache.xml.dtm.ref.ExpandedNameTable
17371 instances of class org.apache.xml.dtm.ref.ExpandedNameTable$HashEntry[]
17370 instances of class int[][][]
17369 instances of class com.sun.org.apache.xerces.internal.dom.AttributeMap
17369 instances of class com.sun.org.apache.xerces.internal.dom.ElementImpl
17369 instances of class com.sun.org.apache.xerces.internal.dom.TextImpl
17369 instances of class org.apache.xml.dtm.ref.dom2dtm.DOM2DTM
17369 instances of class org.apache.xml.utils.TreeWalker
17368 instances of class org.apache.xml.utils.DOM2Helper
17367 instances of class org.xml.sax.helpers.LocatorImpl
1191 instances of class java.lang.Class
987 instances of class java.util.Hashtable$Entry
832 instances of class java.util.HashMap$Entry
232 instances of class org.apache.xml.serializer.EncodingInfo 

> Extremely high memory usage (and OutOfMemory) when using EXSLT str:tokenize or str:split
> ----------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2215
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2215
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan-extensions
>    Affects Versions: 2.7
>         Environment: Tested on both:
> Windows XP Pro (Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing))
> and
> Redhat Linux (Java HotSpot(TM) Client VM (build 1.4.2_08-b03, mixed mode))
>            Reporter: Michael Heinrichs
>         Attachments: test.zip
>
>
> There appears to be a severe memory usage issue when using the EXSLT functions str:tokenize or str:split as included in the latest version of Xalan (2.7.0, and also 2.6.1).  Even for relatively small XML files, when repeatedly using these functions, we are encountering OutOfMemory exceptions even with large (2GB) maximum heap sizes.  The code for these extension functions looks quite straightforward, so I suspect the problem lies deeper.
> I created a simple testcase to demonstrate the problem (see attached zip file).  Setting 1GB max heap, in this particular example (on Windows), I hit another exception (No more DTM IDs are available) before I reached OutOfMemoryError, but I imagine that if I tweak my example appropriately, I would hit OutOfMemory instead (on Linux, I get OutOfMemoryError).  This example XML contains 10,000 rows, and is ~312K.
> If I use the stylesheet version of the EXSLT function, I don't encounter this memory issue.
> Example command-line:
> > java -cp "C:\tmp\xalan-j_2_7_0\xalan.jar;C:\tmp\xalan-j_2_7_0\serializer.jar;C:\tmp\xalan-j_2_7_0\xml-apis.jar;C:\tmp\xalan-j_2_7_0\xercesImpl.jar" -Xmx1024m org.apache.xalan.xslt.Process -IN test.xml -XSL test.xsl -OUT test_out.xml
> This is the DTM-exception I get:
> file:///c:/tmp/test.xsl; Line #12; Column #61; XSLT Error (javax.xml.transform.TransformerException): No more DTM IDs are available Exception in thread "main" java.lang.RuntimeException: No more DTM IDs are available
>         at org.apache.xalan.xslt.Process.doExit(Process.java:1153)
>         at org.apache.xalan.xslt.Process.main(Process.java:1126)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org