ICEpdf
  1. ICEpdf
  2. PDF-585

OutOfMemoryError due to ImageUtility.makeImageWithRasterFromBytes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.0.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      Pro, JAI
    • Salesforce Case Reference:
    • Workaround Description:
      The image is quite large 4959x3506. Recommend increasing the heap sized to -Xmx256m .

      Description

      The PDF renders correctly, when compared to Adobe, but the following exception is thrown:

      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(DirectColorMo
      del.java:1015)
      at java.awt.image.BufferedImage.<init>(BufferedImage.java:324)
      at org.icepdf.core.pobjects.ImageUtility.makeImageWithRasterFromBytes(ImageUtil
      ity.java:1461)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:403)
      at org.icepdf.core.pobjects.ImageStream.getImage(ImageStream.java:295)
      at org.icepdf.core.pobjects.graphics.ImageStreamReference.run(ImageStreamRefere
      nce.java:66)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
      va:895)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
      18)
      at java.lang.Thread.run(Thread.java:680)

        Activity

        Tyler Johnson created issue -
        Tyler Johnson made changes -
        Field Original Value New Value
        Salesforce Case Reference 5007000000T8lHWAAZ
        Tyler Johnson made changes -
        Attachment Case12175.pdf [ 15892 ]
        Patrick Corless made changes -
        Workaround Description The image is quite large 4959x3506. Recommend increasing the heap sized to -Xmx256m .
        Hide
        Patrick Corless added a comment -

        The image in question is quite large and requires that the JVM be assinged more memory. I would recommend setting the system property -Xmx256m.

        Show
        Patrick Corless added a comment - The image in question is quite large and requires that the JVM be assinged more memory. I would recommend setting the system property -Xmx256m.
        Patrick Corless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0.2 [ 10972 ]
        Resolution Won't Fix [ 2 ]
        Hide
        Tyler Johnson added a comment -

        Both the user and I still see the exception with heap size -Xmx256m, -Xmx512m and -Xmx1024m

        Show
        Tyler Johnson added a comment - Both the user and I still see the exception with heap size -Xmx256m, -Xmx512m and -Xmx1024m
        Hide
        Patrick Corless added a comment -

        Tyler can you get the JVM and OS being used?

        Show
        Patrick Corless added a comment - Tyler can you get the JVM and OS being used?
        Hide
        Tyler Johnson added a comment -

        Tested on Win 7 and Win 8 with JVM 7 update 21.

        Show
        Tyler Johnson added a comment - Tested on Win 7 and Win 8 with JVM 7 update 21.
        Hide
        Patrick Corless added a comment -

        Going to give a closer look.

        Show
        Patrick Corless added a comment - Going to give a closer look.
        Patrick Corless made changes -
        Resolution Won't Fix [ 2 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Patrick Corless made changes -
        Fix Version/s 5.0.3 [ 11070 ]
        Fix Version/s 5.0.2 [ 10972 ]
        Hide
        Patrick Corless added a comment -

        There isn't much we can do to improve the memory usage in this case. The image is quite large /Width 4959 /Height 3506 and is also masked by an image that is the same size. Effectively we create three image to render the final image. I'll have to look and see if there is a way to optimize the masking process to try and reduce the total amount of memory used.

        Show
        Patrick Corless added a comment - There isn't much we can do to improve the memory usage in this case. The image is quite large /Width 4959 /Height 3506 and is also masked by an image that is the same size. Effectively we create three image to render the final image. I'll have to look and see if there is a way to optimize the masking process to try and reduce the total amount of memory used.
        Hide
        Patrick Corless added a comment -

        Marking as resolved. Reworked imaging code to avoid creating a new RGBA image as we are already working with an image that has an alpha value.

        Show
        Patrick Corless added a comment - Marking as resolved. Reworked imaging code to avoid creating a new RGBA image as we are already working with an image that has an alpha value.
        Patrick Corless made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #36683 Mon Jul 15 10:22:39 MDT 2013 patrick.corless PDF-585 removed a redundant creation of a RGBA image buffer used to apply masking. All usage cases seem to indicate that the buffer is already in RGBA
        Files Changed
        Commit graph MODIFY /icepdf/branches/icepdf-5.0.1/icepdf/core/src/org/icepdf/core/pobjects/ImageUtility.java
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: