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

Memory leak in classloading due to leaking InflateFully() function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1
    • 1.3.0
    • core-libs
    • None
    • ladybird
    • generic
    • generic

        The zip_util interface has the calls ZIP_Open, ZIP_FindEntry, ZIP_ReadEntry, etc., which access zip files on behalf of the system class loader. These utility functions use the zlib library to read zip files. I believe the hotspot VM uses these functions, as well as the "classic" VM.

        The routine responsible for reading in individual zip entries, ZIP_ReadEntry(), uses the 'inflate' portion of the zlib library through a call to InflateFully(). InflateFully calls out to inflateInit2 to initialize the inflater, and inflate() to do the decompression. However, it does not call inflateEnd after this process, and so the zlib library does not release the extra memory it has used. I have observed a memory leak around 40k _per class-file accessed_ out of a compressed zip.

        The solution is simple: add inflateEnd() to the error case and the successful completion case of InflateFully(), and the leak goes away.

        nedim.fresko@Eng 2000-04-24

              zlisunw Zhenghua Li (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: