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

OutOfMemory error from native leak in PNGEnoder class?

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P2 P2
    • 5.0-pool
    • 5.0u18
    • client-libs
    • None

      We are using ImageIO in one of our products and are experiencing OutOfMemory errors from what appears to be a native memory leak. The Java Heap is fine at the point of the error. Here is a stack trace from one of the crashes:

      ------------------

       
       

      Root Cause: java.lang.OutOfMemoryError

              at java.util.zip.Deflater.init(Native Method)
              at java.util.zip.Deflater.<init>(Deflater.java:117)
              at java.util.zip.Deflater.<init>(Deflater.java:126)
              at com.sun.imageio.plugins.png.IDATOutputStream.<init>(PNGImageWriter.java:139)
              at com.sun.imageio.plugins.png.PNGImageWriter.write_IDAT(PNGImageWriter.java:894)
              at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1123)
              at javax.imageio.ImageWriter.write(ImageWriter.java:598)
              at javax.imageio.ImageIO.write(ImageIO.java:1450)
              at javax.imageio.ImageIO.write(ImageIO.java:1524)

      Here is the relevant code from the PNG package:

      ----------------
       

      package com.sun.imageio.plugins.png;

      import java.io.IOException;
      import java.util.zip.Deflater;
      import javax.imageio.stream.ImageOutputStream;
      import javax.imageio.stream.ImageOutputStreamImpl;

      // Referenced classes of package com.sun.imageio.plugins.png:\

      // CRC

      class IDATOutputStream extends ImageOutputStreamImpl
      {
          public IDATOutputStream(ImageOutputStream imageoutputstream, int i)
              throws IOException
          {
              crc = new CRC();
              def = new Deflater(9);
              buf = new byte[512];
              stream = imageoutputstream;
              chunkLength = i;
              startChunk();
          }



      We believe the following bug is applicable:

      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4797189

            dsamersoff Dmitriy Samersoff
            kevibrow Kevin Brown
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: