我们在Fop.0.9.4上打印。 Windows 10系统。 Xml文件大小为1.5mb(不是很大)。
在xml文件中这个结构:
<root>
<element />
<element />
<element />
<element />
... 3000 elements or more
</root>
在xslt文件中我们写
<for-each select="root/element">
<block-container>
<some-simple-elements>
</block-container>
</for-each>
如果页数少于500,则比fop工作,但如果501页或更多打印件崩溃。
日志:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at org.apache.fop.layoutmgr.AbstractLayoutManager.addChildLM(AbstractLayoutManager.java:317)
at org.apache.fop.layoutmgr.AbstractLayoutManager.addChildLMs(AbstractLayoutManager.java:331)
at org.apache.fop.layoutmgr.AbstractLayoutManager.createNextChildLMs(AbstractLayoutManager.java:291)
at org.apache.fop.layoutmgr.LMiter.hasNext(LMiter.java:40)
at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutManager.java:115)
at org.apache.fop.layoutmgr.table.TableCellLayoutManager.getNextKnuthElements(TableCellLayoutManager.java:162)
at org.apache.fop.layoutmgr.table.TableContentLayoutManager.createElementsForRowGroup(TableContentLayoutManager.java:490)
at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getKnuthElementsForRowIterator(TableContentLayoutManager.java:251)
at org.apache.fop.layoutmgr.table.TableContentLayoutManager.getNextKnuthElements(TableContentLayoutManager.java:179)
at org.apache.fop.layoutmgr.table.TableLayoutManager.getNextKnuthElements(TableLayoutManager.java:243)
at org.apache.fop.layoutmgr.BlockContainerLayoutManager$BlockContainerBreaker.getNextKnuthElements(BlockContainerLayoutManager.java:612)
at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:551)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:301)
at org.apache.fop.layoutmgr.BlockContainerLayoutManager.getNextKnuthElementsAbsolute(BlockContainerLayoutManager.java:509)
at org.apache.fop.layoutmgr.BlockContainerLayoutManager.getNextKnuthElements(BlockContainerLayoutManager.java:195)
at org.apache.fop.layoutmgr.StaticContentLayoutManager$StaticContentBreaker.getNextKnuthElements(StaticContentLayoutManager.java:317)
at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:551)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:301)
at org.apache.fop.layoutmgr.StaticContentLayoutManager.doLayout(StaticContentLayoutManager.java:239)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.layoutSideRegion(PageSequenceLayoutManager.java:407)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:415)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.makeNewPage(PageSequenceLayoutManager.java:377)
at org.apache.fop.layoutmgr.PageBreaker.handleBreakTrait(PageBreaker.java:492)
at org.apache.fop.layoutmgr.PageBreaker.startPart(PageBreaker.java:398)
at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:420)
at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:370)
at org.apache.fop.layoutmgr.PageBreaker.doPhase3(PageBreaker.java:262)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:345)
答案 0 :(得分:1)
OOM或OOME(OutOfMemoryError)只是意味着JVM内存不足。发生这种情况时,您基本上有两个选择:
允许JVM使用-Xmx VM参数使用更多内存。例如,允许JVM使用1 GB(1024 MB)的内存:
改进/修复应用程序,以便使用更少的内存。 有关更多信息,请通过此链接
http://www.mkyong.com/eclipse/eclipse-java-lang-outofmemoryerror-java-heap-space/
答案 1 :(得分:1)
使用64位Java运行时
如果您运行的是32位Java运行时,则最大堆大小为1024。但是如果使用64位,则可以达到CPU RAM的最大值。就我而言,我需要设置为9216MB,并且最多可以渲染5,000页PDF。