When I tested over 130 pages the PNG render crashed with this dump.
 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
 at
java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45)
 at java.lang.StringBuilder.<init>(StringBuilder.java:92)
 at org.apache.fop.area.inline.SpaceArea.<init>(SpaceArea.java:43)
 at org.apache.fop.area.inline.TextArea.addSpace(TextArea.java:82)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager$TextAreaBuilder.addSpa
ces(TextLayoutManager.java:578)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager$TextAreaBuilder.setTex
t(TextLayoutManager.java:497)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager$TextAreaBuilder.build(
TextLayoutManager.java:442)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager$TextAreaBuilder.access
$1(TextLayoutManager.java:435)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager.addAreaInfoAreas(TextL
ayoutManager.java:369)
 at
org.apache.fop.layoutmgr.inline.TextLayoutManager.addAreas(TextLayoutMan
ager.java:297)
 at
org.apache.fop.layoutmgr.inline.InlineLayoutManager.addAreas(InlineLayou
tManager.java:479)
 at
org.apache.fop.layoutmgr.inline.LineLayoutManager.addInlineArea(LineLayo
utManager.java:1561)
 at
org.apache.fop.layoutmgr.inline.LineLayoutManager.addAreas(LineLayoutMan
ager.java:1430)
 at
org.apache.fop.layoutmgr.BlockLayoutManager.addAreas(BlockLayoutManager.
java:389)
 at
org.apache.fop.layoutmgr.AreaAdditionUtil.addAreas(AreaAdditionUtil.java
:121)
 at
org.apache.fop.layoutmgr.BlockContainerLayoutManager$BlockContainerBreak
er.addAreas(BlockContainerLayoutManager.java:939)
 at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:6
26)
 at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:4
97)
 at
org.apache.fop.layoutmgr.BlockContainerLayoutManager$BlockContainerBreak
er.addContainedAreas(BlockContainerLayoutManager.java:965)
 at
org.apache.fop.layoutmgr.BlockContainerLayoutManager.addAreas(BlockConta
inerLayoutManager.java:1158)
 at
org.apache.fop.layoutmgr.BlockLayoutManager.addAreas(BlockLayoutManager.
java:389)
 at
org.apache.fop.layoutmgr.AreaAdditionUtil.addAreas(AreaAdditionUtil.java
:121)
 at
org.apache.fop.layoutmgr.FlowLayoutManager.addAreas(FlowLayoutManager.ja
va:342)
 at org.apache.fop.layoutmgr.PageBreaker.addAreas(PageBreaker.java:280)
 at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:6
26)
 at
org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:4
97)
 at org.apache.fop.layoutmgr.PageBreaker.doPhase3(PageBreaker.java:308)
 at
org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:4
50)
 at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:85)
 at
org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSe
quenceLayoutManager.java:107)
 at
org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java
:238)
 at
org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:12
0)


________________________________

From: Michael Rubin [mailto:mru...@thunderhead.com] 
Sent: Wednesday, May 18, 2011 8:24 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: Fop Memory Use



Just a wild thought. But is there a way you could possibly get the JVM
to garbage collect between each run? Maybe that might free the memory
up?

Thanks.

-Mike

On 18/05/11 13:20, Eric Douglas wrote: 

        I am using Fop 1.0. 
        I tried using Fop to transform a single document.  When I got a
little over 100 pages my FO file was over 5 MB.  The transform crashed
with a Java heap out of memory error.

        I managed to break the input down, as I'm using embedded code
generating the input programmatically, and the PDF output is a lot
smaller.

        So I'm currently transforming 10 pages at a time, setting the
initial-page-number to the next sequence (1, 11, 21, etc).

        Then I save all the generated PDFs in memory and merge them
using pdfbox.  So far this is working great. 

        I tried to do the same thing with the PNGRenderer, just calling
a method to transform 10 pages at a time and save the output images in
an array.

        The PNGRenderer is created locally in the method.  It should be
getting released when the method ends but the java process never
releases any memory.

        I tested a 90 page report and the memory use was over 1 GB.  I
tested on another machine where the memory limit is apparently lower and
it crashed on page 24.

        Everything about the method to render to PNG is the same as the
method to render to PDF aside from the Renderer. 
        Is there a problem with this renderer or something I could need
to do different? 



                                
Michael Rubin

Developer

 Thunderhead
Logo<http://thunderhead.com/email_signature/images/Thunderhead-logo.png>
Tagline<http://thunderhead.com/email_signature/images/make-every-communi
cation-count.png>
Triangles<http://thunderhead.com/email_signature/images/triangles.png>  
 T

 F

 M

 E

 W

+44 20 8238 7400 

+44 20 8238 7401 

 

mru...@thunderhead.com 

www.thunderhead.com <http://www.thunderhead.com>   

Thunderhead featured in The Sunday Times Profit Track 100 league table
of companies with fastest-growing profits. Click here
<http://www.fasttrack.co.uk/fasttrack/press/pt11-lon.pdf>  to read more.


LinkedIn <http://www.linkedin.com/companies/25033/Thunderhead>  twitter
<http://twitter.com/Thunderheadon> RSS
<http://www.thunderhead.com/rss/rss.php> YouTube
<http://www.youtube.com/user/ThunderheadOn>
<http://thunderheadinnovate.wordpress.com/>  were-hiring
<http://thunderhead.com/about/careers.php>      
The contents of this e-mail are intended for the named addressee only.
It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it,
or disclose it to anyone else. If you received it in error please notify
us immediately and then destroy it.

Reply via email to