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 Johannes Franz <jo...@rub.de> on 2004/08/09 14:44:27 UTC

OutOfMemoryException

Hello,

i am buildung a pdf which includes png. The used java library is jimi-1.0.jar. If i include to much png-images i get the OutOfMemoryException. The answer of the FAQ is to increase the memory which is allocated for java. Could you explain me how i can do this? Do you have any other solutions for the OutOfMemoryException? Do you thinks using JAI instead of JIMI could help?

Greetings,
Johannes.


Re: OutOfMemoryException

Posted by Johannes Franz <jo...@rub.de>.
I forgot to mention that I am using a batch process which only uses the
function one after another and not parallel. Perhaps the solution to my
problem is to reduce the maximum Number of parallel Threads to 1. It seems
that the programmers of fop set this number on 5. Perhaps somebody knows the
position in the jar where i can reduce this number. (I am using Jai for the
png)

Greetings,
Johannes.
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Tuesday, August 10, 2004 10:00 PM
Subject: Re: OutOfMemoryException


> Johannes Franz wrote:
> > i am buildung a pdf which includes png. The used java library is
> > jimi-1.0.jar. If i include to much png-images i get the
> > OutOfMemoryException. The answer of the FAQ is to increase the memory
> > which is allocated for java. Could you explain me how i can do this?
>
> Check your friendly Java documentation. The online version is
> actually linked from the hint in the FOP documentation:
>   http://xml.apache.org/fop/running.html#memory
>   http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html
>
> > Do
> > you have any other solutions for the OutOfMemoryException? Do you thinks
> > using JAI instead of JIMI could help?
>
> It depends. It is likely the problem is caused by the image cache.
> Reducing the PNG resolution or switching to a format which compresses
> better (low quality JPEG) might help.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>


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


Re: OutOfMemoryException

Posted by Johannes Franz <jo...@rub.de>.
The problem with JPEG is, that it really supersizes my pdf. But i'll try it.
THX sofar.
----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Wednesday, August 11, 2004 9:41 PM
Subject: Re: OutOfMemoryException


> Johannes Franz wrote:
>
> > I thin i will try it nevertheless, because i don't know what to do
> > otherwise. I really need to create a pdf which contains a lot of images.
> > Do you have any other solutions for my problem?
>
> Try JPEG. It shouldn't require as much ressources as PNG.
> Bump up physical memory of the machine, 1G or 1.5G, and
> allocate as much as possible for the JVM. Disable swapping.
>
> Using JPEG and wrap it in an SVG might help too.
>
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>


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


Re: OutOfMemoryException

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Johannes Franz wrote:

> I thin i will try it nevertheless, because i don't know what to do
> otherwise. I really need to create a pdf which contains a lot of images.
> Do you have any other solutions for my problem?

Try JPEG. It shouldn't require as much ressources as PNG.
Bump up physical memory of the machine, 1G or 1.5G, and
allocate as much as possible for the JVM. Disable swapping.

Using JPEG and wrap it in an SVG might help too.

J.Pietschmann


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


Re: OutOfMemoryException

Posted by Johannes Franz <jo...@rub.de>.
I thin i will try it nevertheless, because i don't know what to do
otherwise. I really need to create a pdf which contains a lot of images.
Do you have any other solutions for my problem?

----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Wednesday, August 11, 2004 9:18 PM
Subject: Re: OutOfMemoryException


> Bernd Brandstetter wrote:
> > I had a similar problem some time ago when I tried to create a PDF
> > containing hundreds of SVG images. I finally got it to work by disabling
> > image caching completely by commenting out the line 267
> > "m_urlMap.put(href, imageInstance);" in FopImageFactory.java
(fop-0.20.5)
> >
> This wont help much (and probably even hurt) for most bitmap image
> formats, because the associated PDF XObject which also refers to the
> pixel array hangs around until the PDF object dictionary is written,
> which is just before the result stream is finished. Unfortunately
> this can't be changed easily in the 0.20.x branch.
>
> > It would be nice if the next version of fop could provide a means to
either
> > turn off image caching (as a configuration option) or to limit the cache
> > size.
>
> The redesigned code apparently discards pixel information after it
> is written to the result stream, and it also supports reuse of
> PDF objects better, so this may be actually implemented. Note that
> limiting the cache size can lead to unexpected behaviour for
> dynamically generated images.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>


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


Re: OutOfMemoryException

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Bernd Brandstetter wrote:
> I had a similar problem some time ago when I tried to create a PDF 
> containing hundreds of SVG images. I finally got it to work by disabling 
> image caching completely by commenting out the line 267
> "m_urlMap.put(href, imageInstance);" in FopImageFactory.java (fop-0.20.5)
> 
This wont help much (and probably even hurt) for most bitmap image
formats, because the associated PDF XObject which also refers to the
pixel array hangs around until the PDF object dictionary is written,
which is just before the result stream is finished. Unfortunately
this can't be changed easily in the 0.20.x branch.

> It would be nice if the next version of fop could provide a means to either 
> turn off image caching (as a configuration option) or to limit the cache 
> size.

The redesigned code apparently discards pixel information after it
is written to the result stream, and it also supports reuse of
PDF objects better, so this may be actually implemented. Note that
limiting the cache size can lead to unexpected behaviour for
dynamically generated images.

J.Pietschmann

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


Re: OutOfMemoryException

Posted by Bernd Brandstetter <bb...@freenet.de>.
On Tuesday 10 August 2004 23:03, Johannes Franz wrote:
> The pngs are the lowest sized images i can get. If i increase the
> memory, which is allocated for java to the size that is necessary for
> the amount of images, my system really slows down and nearly hangs up.
> Is there perhaps an option to force fop to delete the imagecache?
> Because without such an option it is not possible to create pdfs with a
> really big size of images.

I had a similar problem some time ago when I tried to create a PDF 
containing hundreds of SVG images. I finally got it to work by disabling 
image caching completely by commenting out the line 267
"m_urlMap.put(href, imageInstance);" in FopImageFactory.java (fop-0.20.5)

It would be nice if the next version of fop could provide a means to either 
turn off image caching (as a configuration option) or to limit the cache 
size.

Regards,
Bernd

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


Re: OutOfMemoryException

Posted by Johannes Franz <jo...@rub.de>.
The pngs are the lowest sized images i can get. If i increase the memory,
which is allocated for java to the size that is necessary for the amount of
images, my system really slows down and nearly hangs up. Is there perhaps an
option to force fop to delete the imagecache? Because without such an option
it is not possible to create pdfs with a really big size of images.


----- Original Message -----
From: "J.Pietschmann" <j3...@yahoo.de>
To: <fo...@xml.apache.org>
Sent: Tuesday, August 10, 2004 10:00 PM
Subject: Re: OutOfMemoryException


> Johannes Franz wrote:
> > i am buildung a pdf which includes png. The used java library is
> > jimi-1.0.jar. If i include to much png-images i get the
> > OutOfMemoryException. The answer of the FAQ is to increase the memory
> > which is allocated for java. Could you explain me how i can do this?
>
> Check your friendly Java documentation. The online version is
> actually linked from the hint in the FOP documentation:
>   http://xml.apache.org/fop/running.html#memory
>   http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html
>
> > Do
> > you have any other solutions for the OutOfMemoryException? Do you thinks
> > using JAI instead of JIMI could help?
>
> It depends. It is likely the problem is caused by the image cache.
> Reducing the PNG resolution or switching to a format which compresses
> better (low quality JPEG) might help.
>
> J.Pietschmann
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
>
>



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


Re: OutOfMemoryException

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Johannes Franz wrote:
> i am buildung a pdf which includes png. The used java library is 
> jimi-1.0.jar. If i include to much png-images i get the 
> OutOfMemoryException. The answer of the FAQ is to increase the memory 
> which is allocated for java. Could you explain me how i can do this?

Check your friendly Java documentation. The online version is
actually linked from the hint in the FOP documentation:
  http://xml.apache.org/fop/running.html#memory
  http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html

> Do 
> you have any other solutions for the OutOfMemoryException? Do you thinks 
> using JAI instead of JIMI could help?

It depends. It is likely the problem is caused by the image cache.
Reducing the PNG resolution or switching to a format which compresses
better (low quality JPEG) might help.

J.Pietschmann

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