xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Meyer <rme...@hotmail.co.uk>
Subject RE: Memory usage and page numbering...
Date Fri, 09 Aug 2013 09:02:44 GMT
Hi Bernard,

>From my experience of trying to study the memory impact between builds, the getRuntime().freeMemory()
method I found was very unreliable due to the nature of the JVM. I was getting back different
results each time I ran it and even after purposefully modifying one build to run inefficiently,
it returned the opposite to what I was expecting. As such, I ended up using a profiler which
allowed me to break it down to see what was being run and identify memory hot spots and differences
without being hampered by the somewhat random garbage collection.

Another method would be to generate and compare hprof dump output. There are a few tools out
there to do this like the Eclipse Memory Analyzer [1]. To generate the dump, I just add the
following to the FOP args:

-Xrunhprof:heap=sites,depth=<depth required>


Robert Meyer

[1] http://www.eclipse.org/mat/

From: thebernmeister@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 15:20:15 +1000

I have a Java desktop application, using embedded FOP to create PDFs from a data XML file
and an XSLT file.  I wanted to see how much memory is being used, given the point about memory
usage, page numbers and page totals (http://xmlgraphics.apache.org/fop/1.1/running.html#memory).
My PDF reports have a "page N of TOTAL" at the bottom right of each page and I wanted to see
the memory usage and compare to no page numbers and just page numbers without totals.  I also
used the two variations for page number totals (XSL 1.0 and XSL 1.1).
To work out the memory usage I computed the difference when calling Runtime.getRuntime().freeMemory()
at the start and end of the render process.  I ran each render variation 5 times from a shell
script and each render kicked off a separate JVM to avoid any caching.  Regardless of whether
I had page numbers or not, and page totals or not, it seemed the result is that there is no
difference between having page numbers/totals or not.  Sometimes the memory usage was 50 MB
and sometimes 200 MB.
I then used the sample code and data files from embedded FOP, http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_1/examples/embedding/.
 I modified the data XML file to contain lots of entries, giving a data file size of about
1 MB.  I also modified the XLST file to include pages numbers and then also page totals. 
Again, I noticed no difference in memory usage.
Given the varying values for memory usage I'm seeing, I assume my quick and dirty method is
inadequate.  I expected variation, but mostly to see far less memory usage when no page totals
were used, but that's not the case.
Has anyone seen similar results?  Does using page totals really use THAT much more memory
compared to not using page totals?
Thanks in advance,Bernard. 		 	   		   		 	   		  
View raw message