[ https://issues.apache.org/jira/browse/PDFBOX-2825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579679#comment-14579679 ]
Tilman Hausherr commented on PDFBOX-2825: ----------------------------------------- What could be done is this: 1. PDStream needs a method to return an array based on 2. 2. COSStream needs a method to return an array (unfiltered data, i.e. decoded) 3. This would be done analog to COSStream.getUnfilteredStream(). In that method, the length of the data is known. So a different method, e.g. getUnfilteredArray(), could be created that directly writes into a byte array. > Requested array size exceeds VM limit > ------------------------------------- > > Key: PDFBOX-2825 > URL: https://issues.apache.org/jira/browse/PDFBOX-2825 > Project: PDFBox > Issue Type: Bug > Components: Rendering > Affects Versions: 2.0.0 > Reporter: Dmitry Andreev > Labels: newbie > > Hi, I've got this OOM exception when trying to render big file. > {code} > Exception in thread "main" java.lang.OutOfMemoryError: Requested array size > exceeds VM limit > at java.util.Arrays.copyOf(Arrays.java:3230) > at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113) > at > java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) > at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140) > at org.apache.pdfbox.io.IOUtils.copy(IOUtils.java:68) > at org.apache.pdfbox.io.IOUtils.toByteArray(IOUtils.java:50) > at > org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.from8bit(SampledImageReader.java:244) > at > org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:149) > at > org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:246) > at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:766) > at > org.apache.pdfbox.contentstream.operator.graphics.DrawObject.process(DrawObject.java:51) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:802) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:464) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:438) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149) > at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:180) > at > org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:205) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:136) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:69) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:56) > {code} > It's there something way to fix this? -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org