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

java.util.jar.Pack200.Packer Memory Leak

XMLWordPrintable

    • b109
    • generic, x86
    • generic, linux_2.6, windows_vista
    • Not verified

        FULL PRODUCT VERSION :
        java 1.6 all versions

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows Vista Business Edition

        A DESCRIPTION OF THE PROBLEM :
        When you use the Pack200 API from within a Java Program the memory consumed to pack a jar file is never freed.

        The reason is that com.sun.java.util.jar.pack.ConstantPool caches all values in static Hashmaps. When the compression process is finished the maps stay filled and there is no way to get rid of their content.

        This is not critical for a short running packer program but we have an application server that builds .pack.gz install bundles dynamically and suffers from this problem. The ConstantPool gets hughe and consumes all available memory.

        The cache must be per Packer instance and not static.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
          From a java progrma pack200 a big jar file . The memory is never freed.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        After packing finishes the memory of the cache should get freed.
        ACTUAL -
        The memory is not garbage colleted and there is no way to clear the cache manually.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        Start the packing in a new forked java process.

              ksrini Kumar Srinivasan
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: