Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2215

Extremely high memory usage (and OutOfMemory) when using EXSLT str:tokenize or str:split

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7
    • None
    • Xalan-extensions
    • None
    • 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))

    Description

      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)

      Attachments

        1. test.zip
          1 kB
          Michael Heinrichs

        Activity

          People

            Unassigned Unassigned
            mheinrichs Michael Heinrichs
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: