Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6294363

OutOfMemoryError when writing USHORT GRAY images using GIF Writer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • 6
    • client-libs
    • b53
    • generic
    • generic
    • Verified

      I am running an application which writes each of the buffered images into a file using a GIF Writer. I am looping through all the buffered image types and all the output types such as File, FileCacheIOS, MemCacheIOS, RAF, etc. When I choose USHORT GRAY buffered image type, I am getting an OutOfMemoryError in the console.
      Here is the exception:
      java.lang.OutOfMemoryError: Java heap space
      at java.util.ArrayList.<init>(ArrayList.java:113)
      at java.util.ArrayList.<init>(ArrayList.java:120)
      at javax.imageio.metadata.IIOMetadataNode.<init>(IIOMetadataNode.java:308)
      at com.sun.imageio.plugins.gif.GIFImageMetadata.getNativeTree(GIFImageMetadata.java:154)
      at com.sun.imageio.plugins.gif.GIFImageMetadata.getAsTree(GIFImageMetadata.java:110)
      at com.sun.imageio.plugins.gif.GIFImageWriter.convertMetadata(GIFImageWriter.java:300)
      at com.sun.imageio.plugins.gif.GIFImageWriter.write(GIFImageWriter.java:588)
      at com.sun.imageio.plugins.gif.GIFImageWriter.write(GIFImageWriter.java:499)
      at GIFWriterUshortTest.writeBufferedImage(GIFWriterUshortTest.java:122)
      at GIFWriterUshortTest.itemStateChanged(GIFWriterUshortTest.java:57)
      at java.awt.Choice.processItemEvent(Choice.java:610)
      at java.awt.Choice.processEvent(Choice.java:577)
      at java.awt.Component.dispatchEventImpl(Component.java:4360)
      at java.awt.Component.dispatchEvent(Component.java:4194)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:592)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:270)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:198)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:171)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:166)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:119)

      This is reproducible on all mustang builds that has GIF Writer feature. This is not reproducible for any other image writers. This is reproducible on all platforms. I monitored the application with Jconsole and noticed that the mem consumption goes as high as 70MB when using USHORT GRAY buffered image.

      I have attached a sample test. Execute the sample test. You would see a choice having all buffered image types. Choose the items 1 by 1 and the corresponding images will be loaded onto the frame. When you are choosing USHORT_GRAY, you will notice the above exception on the console. I am using the default memory settings for the JVM.
      ###@###.### 2005-07-06 10:21:05 GMT

            bae Andrew Brygin
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: