ICEpdf
  1. ICEpdf
  2. PDF-829

OutOfMemoryError: Requested array size exceeds VM limit

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.1
    • Fix Version/s: 5.1.2
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      All

      Description

      With the provided PDF, the following message is shown leading up to a java.lang.OutOfMemoryError: Java heap space error:

      Nov 07, 2014 11:06:55 AM org.icepdf.ri.common.views.PageViewComponentImpl$PagePainter run
      WARNING: Error creating buffer, page: 0
      java.lang.OutOfMemoryError: Requested array size exceeds VM limit

        Activity

        Hide
        Arran Mccullough added a comment -

        Notes from customer:

        JVM Properties:
        -Djava.util.logging.config.file=/opt/tomcat/properties/iceLogging.properties -d64 -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=256m -Xms256m -Xmx2048m -XX:PermSize=256M -Dfile.encoding=UTF-8

        Method Call Causing the Crash:
        image = (BufferedImage) pdfDocument.getPageImage(0, GraphicsRenderingHints.SCREEN,
        Page.BOUNDARY_CROPBOX, 0f, 2.0 );

        Stack Trace:
        SEVERE: Servlet.service() for servlet fulfillment threw exception
        java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
        at java.awt.image.Raster.createPackedRaster(Raster.java:458)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
        at java.awt.image.BufferedImage.<init>(BufferedImage.java:321)
        at org.icepdf.core.pobjects.graphics.TilingPattern.paintPattern(TilingPattern.java:390)
        at org.icepdf.core.pobjects.graphics.commands.TilingPatternDrawCmd.paintOperand(TilingPatternDrawCmd.java:45)
        at org.icepdf.core.pobjects.graphics.Shapes.paint(Shapes.java:136)
        at org.icepdf.core.pobjects.Page.paintPageContent(Page.java:539)
        at org.icepdf.core.pobjects.Page.paint(Page.java:496)
        at org.icepdf.core.pobjects.Page.paint(Page.java:428)
        at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1102)

        Show
        Arran Mccullough added a comment - Notes from customer: JVM Properties: -Djava.util.logging.config.file=/opt/tomcat/properties/iceLogging.properties -d64 -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=256m -Xms256m -Xmx2048m -XX:PermSize=256M -Dfile.encoding=UTF-8 Method Call Causing the Crash: image = (BufferedImage) pdfDocument.getPageImage(0, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0f, 2.0 ); Stack Trace: SEVERE: Servlet.service() for servlet fulfillment threw exception java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41) at java.awt.image.Raster.createPackedRaster(Raster.java:458) at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015) at java.awt.image.BufferedImage.<init>(BufferedImage.java:321) at org.icepdf.core.pobjects.graphics.TilingPattern.paintPattern(TilingPattern.java:390) at org.icepdf.core.pobjects.graphics.commands.TilingPatternDrawCmd.paintOperand(TilingPatternDrawCmd.java:45) at org.icepdf.core.pobjects.graphics.Shapes.paint(Shapes.java:136) at org.icepdf.core.pobjects.Page.paintPageContent(Page.java:539) at org.icepdf.core.pobjects.Page.paint(Page.java:496) at org.icepdf.core.pobjects.Page.paint(Page.java:428) at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1102)
        Hide
        Patrick Corless added a comment -

        The issue is related to the zig-zaged coloured background. When we calculate the tile size we get some really large image values which is causing the memory issue. I'll need to do some work here to figure out what is going wrong with this PDF.

        Show
        Patrick Corless added a comment - The issue is related to the zig-zaged coloured background. When we calculate the tile size we get some really large image values which is causing the memory issue. I'll need to do some work here to figure out what is going wrong with this PDF.
        Hide
        Patrick Corless added a comment -

        The zig-zaged background has incorrectly recorded step value for the tiling definition As a result we try to paint a very large image tile and pop the jvm. We have a text for such a case but due to a small logic error this corner case was not caught. Update the step dimension check and PDF now renders correctly.

        Show
        Patrick Corless added a comment - The zig-zaged background has incorrectly recorded step value for the tiling definition As a result we try to paint a very large image tile and pop the jvm. We have a text for such a case but due to a small logic error this corner case was not caught. Update the step dimension check and PDF now renders correctly.
        Hide
        Patrick Corless added a comment -

        Marking as fixed.

        Show
        Patrick Corless added a comment - Marking as fixed.

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: