You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2019/11/17 05:38:00 UTC

[jira] [Comment Edited] (PDFBOX-4690) PDFBOX running out of memory when rendering into image

    [ https://issues.apache.org/jira/browse/PDFBOX-4690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16975581#comment-16975581 ] 

Tilman Hausherr edited comment on PDFBOX-4690 at 11/17/19 5:37 AM:
-------------------------------------------------------------------

It uses 11GB. There's a giant temporary image 29314 x 46261 being created from a stencil image using a pattern "color" to fit the current size.
{code}
  /R156 scn
  q
    3085.63 5738.89 229.008 627.875 re
    W
    n
    q
      293134 0 0 -462602 3085.63 468339 cm
      /R158 Do
    Q
  Q
  /R157 cs
  /R160 scn
  q
    1454.64 5101.84 221.191 663.57 re
    W
    n
    q
      276849 0 0 -476343 1457.1 481444 cm
      /R158 Do
    Q
  Q
{code}
I created some code to limit that temporary image to the size of the device, using {{graphics.getDeviceConfiguration().getBounds()}}. I'll commit this code after cleaning up what I did and having a second look.


was (Author: tilman):
It uses 11GB. There's a giant temporary image 29314 x 46261 being created from a stencil image using a pattern "color" to fit the current size.

I created some code to limit that temporary image to the size of the device, using {{graphics.getDeviceConfiguration().getBounds()}}. I'll commit this code after cleaning up what I did and having a second look.

> PDFBOX running out of memory when rendering into image
> ------------------------------------------------------
>
>                 Key: PDFBOX-4690
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4690
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.11, 2.0.16, 2.0.17
>         Environment: Docker Container with linux
> I have allocated 10GB of RAM.
>            Reporter: Himanshu Pandey
>            Priority: Blocker
>         Attachments: crash.pdf
>
>
> I am running into Out of memory when trying to render attached PDF at page number 4.
> {{ }}
> {{ java.lang.OutOfMemoryError: Java heap spacejava.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:75) at java.awt.image.Raster.createPackedRaster(Raster.java:467) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032) at java.awt.image.BufferedImage.<init>(BufferedImage.java:333) at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:979) at org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:62) at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477) at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150) at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:246) at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225) at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164)}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org