fop-users  

Re: Memory Leak issue -- FOP

Craig Ringer
Tue, 31 Aug 2010 23:03:42 -0700

On 30/08/10 22:29, Hamed Mohammed wrote:
> Hi,
>  
> This is how I am using FOP to process XSL.FO <http://XSL.FO> into PDF. I
> agree that the issue is to do with too much of memory consumption. Is
> there a better way to process this large FO file into PDF using FOP?

How much memory is too much? Have you used the JVM's tools to find out
*where* the memory is going?

If you don't know Java's profiling tools well, you might want to try the
rather user-friendly memory profiler in NetBeans. NetBeans opens Maven
projects directly, and can be set up for a generic Ant project quite
quickly, so if you're not already using it there's no reason not to just
for this.

> String xml = builder.getReport(); /// gets the XSL:FO file data approx 50mb

If you're concerned about memory consumption, writing your XSL-FO to a
tempfile rather than an in-memory string and passing that to FOP's SAX
engine would be a big help. Or, for that matter, writing directly to the
SAX handler's InputStream, progressively generating the document as it's
required so it never has to exist entirely in memory or on disk.

> PdfStorage pdfHolder = pdfStorageFactory.createStorage(reportRequest,

What's PdfStorage? It doesn't seem to be in fop's packages...

Any chance you can post a self-contained test program that demonstrates
the problem you describe, along with sample input for it?

-- 
Craig Ringer

Tech-related writing: http://soapyfrogs.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org