You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Fabrizio Caldas <fa...@gmail.com> on 2006/01/23 23:09:28 UTC

[Servlet Error]-[]: java.lang.OutOfMemoryError

Hello all,

I'm using FOP 0.20.5 on a Unix box.
The code is embedded and the pdf is rendered as an InputStream and
attached and sent thru e-mail.

I'm getting a [Servlet Error]-[]: java.lang.OutOfMemoryError when
creating the PDF files in Asian langs only.
The English version of the file works fine.

I've tried most the memory tips in the FOP site:
1) - Avoiding forward references
2) - Avoiding large images
3) - Used multiple page sequences.

I haven't changed the -Xmx option, because that is the last thing the
server guys want.

I'm trying to do whatever is possible first.
Is there any possibility of reducing memory usage when embedding fonts?
This is the user config file I'm using:


<configuration>
<fonts>
<font metrics-file="/home/msgothic.xml"
embed-file="/home/msgothic.ttc" kerning="yes">
  <font-triplet name="MS Gothic" style="normal" weight="normal"/>
  <font-triplet name="MS Gothic" style="normal" weight="bold"/>
  <font-triplet name="MS Gothic" style="italic" weight="normal"/>
  <font-triplet name="MS Gothic" style="italic" weight="bold"/>
</font>
<font metrics-file="/home/mingliu.xml" embed-file="/home/mingliu.ttc"
kerning="yes">
  <font-triplet name="MingLiU" style="normal" weight="normal"/>
  <font-triplet name="MingLiU" style="normal" weight="bold"/>
  <font-triplet name="MingLiU" style="italic" weight="normal"/>
  <font-triplet name="MingLiU" style="italic" weight="bold"/>
</font>
<font metrics-file="/home/simsun.xml" embed-file="/home/simsun.ttc"
kerning="yes">
  <font-triplet name="SimSun" style="normal" weight="normal"/>
  <font-triplet name="SimSun" style="normal" weight="bold"/>
  <font-triplet name="SimSun" style="italic" weight="normal"/>
  <font-triplet name="SimSun" style="italic" weight="bold"/>
</font>
<font metrics-file="/home/gulim.xml" embed-file="/home/gulim.ttc" kerning="yes">
  <font-triplet name="Gulim" style="normal" weight="normal"/>
  <font-triplet name="Gulim" style="normal" weight="bold"/>
  <font-triplet name="Gulim" style="italic" weight="normal"/>
  <font-triplet name="Gulim" style="italic" weight="bold"/>
</font>
</fonts>
</configuration>

Regards,

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


Re: [Servlet Error]-[]: java.lang.OutOfMemoryError

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Fabrizio Caldas wrote:
> I'm getting a [Servlet Error]-[]: java.lang.OutOfMemoryError when
> creating the PDF files in Asian langs only.

Best guess: East Asian fonts tend to be large, and much of the
data is held in memory - multiple times - while finishing the PDF.

There is no easy way around this (except giving the JVM as much memory
as possible - check the FAQ).
Some more hints:
- Serialize all FOP requests through a singleton. This avoids having
  two (or more) parallel threads both eating lots of memory, but may
  have an overall negative performance impact  on your application.
- If you know in advance that you use only a relatively small subset
  of all east asian characters, look for an appropriate font or create
  a custom font.


J.Pietschmann

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