You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ro...@lotus.com on 2000/02/25 21:17:50 UTC

Re: Memory Usage of XSLT processor

You're numbers look a bit low to me.  Of course, it really depends on the
size of you're document and the complexity of your stylesheet.  I've
profiled memory usage of Xalan with OptimizeIt! 3.0 and even with a single
thread a moderate document seems to take a few MB's to process.  And with a
complex stylesheet, like DocBook, you could take 15MB.  OptimizeIt! shows
the top items being things like Object[] and char[].  But again, this will
vary depending on your stylesheet and document.

I've been doing work to reduce the memory overhead (DocBook used to require
150MB!), so if you see something like looks bigger than you expected let me
know and we can try to figure something out.

An interesting thing to try is run your program from the command line with
various settings of the heap size (java.exe's -mx parameter) and see how
low you can make it.

BTW, we should continue this discussion on the xalan-dev list.

-Rob



                                                                                                                                              
                    mfoley@silver                                                                                                             
                    stream.com           To:     general@xml.apache.org                                                                       
                    (Mike Foley)         cc:     (bcc: Robert Weir/CAM/Lotus)                                                                 
                                         Subject:     Memory Usage of XSLT processor                                                          
                    02/25/00                                                                                                                  
                    12:47 PM                                                                                                                  
                    Please                                                                                                                    
                    respond to                                                                                                                
                    general                                                                                                                   
                                                                                                                                              
                                                                                                                                              



Hello,

I am trying to get a handle on how much memory the XSLT processor uses
in the VM when I use it as I've described below.  I'm using a heap tool
and I see the number of bytes used by the following classes as I've
described below.  There are a total of 80 classes, these are the top 6
by bytes used in the vm, and represent over 90% of the total bytes, so
I'm omitting the other classes.

org.apache.xalan.xpath.dtm.DTMProxy[]    4100
org.apache.xalan.xslt.ElemTextLiteral            884
org.apache.xalan.xslt.ElemLiteralResult       1860
org.apache.xalan.xslt.AVT                           1120
org.apache.xalan.xpath.DTMXPath                 864
org.apache.xalan.xpath.DTMProxy[]            4100

----------

12928 bytes, approx 1.3K

So my question is: is it a resasonable assumption for me to make that
the code below uses about 1.3K of memory?

The reason I'm asking is that I'm going to be potentially executing the
block of code below by maybe 1000 different threads, and am trying to
get a handle on the memory requirement.  1.3K * 1000 = 1.3MB.  yes?

Thanks in advance for any advice, confirmation, flames....

Mike

This is the code being executed:

 // Transform the layou XML & XSL to HTML using the XSLT Processor
  org.apache.xalan.xslt.XSLTProcessor processor =
org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor();

  org.apache.xalan.xslt.XSLTInputSource xmlSource =
    new org.apache.xalan.xslt.XSLTInputSource(new
java.io.ByteArrayInputStream(xmlBuffer.toString().getBytes()));

  org.apache.xalan.xslt.XSLTInputSource xslSheet =
   new org.apache.xalan.xslt.XSLTInputSource(new
java.io.ByteArrayInputStream(xslBuffer.toString().getBytes()));

 org.apache.xalan.xslt.XSLTResultTarget xmlResult = new
org.apache.xalan.xslt.XSLTResultTarget(byteOut);

  processor.process(xmlSource, xslSheet, xmlResult);