pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Agarwal <ankyizh...@gmail.com>
Subject Re: PDFRendering
Date Mon, 27 Jun 2016 16:54:16 GMT
I was getting the error even when I was rendering just 3-4 pages. So i
don't think it was due to any memory leak.

On Mon, Jun 27, 2016 at 10:17 PM, Ankit Agarwal <ankyizhere@gmail.com>
wrote:

> Hi, Thanks for the reply.
> I am using  32 bit jvm and 1.5 gb of heap size.
> Still I was getting out of memory error when i was rendering pdf with
> multiple pages.
> When i introduced system.gc call after each page (which is not ideal and
> bad programming choice) , then the pages were being rendered without an
> error.
> So I think that the bufferedImage from previous page wasn't being cleared
> and the next page was loaded( but in my code the image object is flushed
> before another use so this shouldn't happen).Anyways system.gc() solved
> this for now.
> But as we know we cannot be sure that system.gc() will call the garbage
> colelctor as the final decision lies with the jvm. So I guess, I'll just
> have to try my luck here and continue with the code.
> Thanks
>
> On Mon, Jun 27, 2016 at 9:17 PM, Tilman Hausherr <THausherr@t-online.de>
> wrote:
>
>> Am 27.06.2016 um 15:39 schrieb John Hewson:
>>
>>> On 24 Jun 2016, at 00:55, Ankit Agarwal <ankyizhere@gmail.com> wrote:
>>>>
>>>> Hi,
>>>> When i try to covert pdf to image then for some pdfs i get a "out of
>>>> memory" error. So i increased heap size and then i again got the error
>>>> for
>>>> some different pdf file.
>>>> for the time being assume I have no memory leak from other objects. So
>>>> what
>>>> would be the reason for this memory out of error?
>>>> Would it be just that the image is so large(which is not the case i
>>>> think)
>>>> that it consumes heap, or maybe pdfbox stores buffered image of each
>>>> pages
>>>> in its memory and this contributes to the growing heap size?
>>>> Any insight would be wonderful.
>>>>
>>> Usually it’s because the PDF contains a compressed image which is very
>>> large
>>> when decompressed. So the file isn’t big on disk, but it is in memory.
>>> Try using
>>> a 32-bit JVM as these use less memory. 1GB of heap is usually enough but
>>> you
>>> can go larger.
>>>
>>
>> He does use 32bit JVM. I tried two of his files on a 64bit JVM and it has
>> rendered for 24 hours with -Xmx400m.
>>
>>
>> https://stackoverflow.com/questions/38008475/pdf-rendering-using-pdfbox/38010316#38010316
>>
>> Tilman
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message