Extremely high memory usage (and OutOfMemory) when using EXSLT str:tokenize or str:split ----------------------------------------------------------------------------------------
Key: XALANJ-2215 URL: http://issues.apache.org/jira/browse/XALANJ-2215 Project: XalanJ2 Type: Bug Components: Xalan-extensions 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 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. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.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]