You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Sundaravadivelu, Subramani [TNQ]" <su...@tnq.co.in> on 2011/12/01 10:43:36 UTC

WrappedIOException and Java heap space

Hi All,

 

I am a very long user of PDFBOX from version 0.7.3.

 

Recently I updated to the latest version i.e., v1.6.0 of PDFBOX into my
application.

 

But I was reported a strange problem from my customer stating that for some
selected PDFs it throws exception.

 

The same was fine with the version 1.1.0 of PDFBOX.

 

Below is the error thrown in Eclipse JAVA IDE when I run the PDF (around 300
MB in size)

with the version 1.6.0.

 

org.apache.pdfbox.exceptions.WrappedIOException
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:240)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1090)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1054)
at org.apache.pdfbox.pdmodel.PDDocument.main(PDDocument.java:1378)
Caused by: java.lang.OutOfMemoryError: Java heap space
at
org.apache.pdfbox.io.RandomAccessBuffer.expandBuffer(RandomAccessBuffer.java
:151)
at
org.apache.pdfbox.io.RandomAccessBuffer.write(RandomAccessBuffer.java:131)
at
org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutp
utStream.java:108)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
at
org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:448)
at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:552)
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:184)

 

 

In v1.1.0 without any memory allocation (ie using the option -Xmx), I was
able to run the PDF successfully without this exception.

 

But with the version v1.6.0, I need to use the option  "-Xmx" option and
allocate around 1250m size of memory to run the same pdf.

 

Is there any work around to avoid this issue? Please advice.

 

Regards,

Subbu


Re: WrappedIOException and Java heap space

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,

Am 01.12.2011 10:43, schrieb Sundaravadivelu, Subramani [TNQ]:
> Hi All,
>
>
>
> I am a very long user of PDFBOX from version 0.7.3.
>
>
>
> Recently I updated to the latest version i.e., v1.6.0 of PDFBOX into my
> application.
>
>
>
> But I was reported a strange problem from my customer stating that for some
> selected PDFs it throws exception.
>
>
>
> The same was fine with the version 1.1.0 of PDFBOX.
>
>
>
> Below is the error thrown in Eclipse JAVA IDE when I run the PDF (around 300
> MB in size)
>
> with the version 1.6.0.
>
>
>
> org.apache.pdfbox.exceptions.WrappedIOException
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:240)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1090)
> at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1054)
> at org.apache.pdfbox.pdmodel.PDDocument.main(PDDocument.java:1378)
> Caused by: java.lang.OutOfMemoryError: Java heap space
> at
> org.apache.pdfbox.io.RandomAccessBuffer.expandBuffer(RandomAccessBuffer.java
> :151)
> at
> org.apache.pdfbox.io.RandomAccessBuffer.write(RandomAccessBuffer.java:131)
> at
> org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutp
> utStream.java:108)
> at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
> at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
> at
> org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:448)
> at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:552)
> at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:184)
>
>
>
>
>
> In v1.1.0 without any memory allocation (ie using the option -Xmx), I was
> able to run the PDF successfully without this exception.
>
>
>
> But with the version v1.6.0, I need to use the option  "-Xmx" option and
> allocate around 1250m size of memory to run the same pdf.
>
>
>
> Is there any work around to avoid this issue? Please advice.
I answered that question recently, follow [1] for the details.

> Regards,
>
> Subbu


BR
Andreas Lehmkühler

[1] http://markmail.org/thread/ayc2bz5wyjdlkp5i