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

java.util.jar.Pack200.Packer Memory Leak

    Details

    • Subcomponent:
    • Resolved In Build:
      b109
    • CPU:
      generic, x86
    • OS:
      generic, linux_2.6, windows_vista
    • Verification:
      Not verified

      Backports

        Description

        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.

          Issue Links

            Activity

            Hide
            ksrini Kumar Srinivasan added a comment -
            BT2:EVALUATION

            Right the static HashMaps in the ConstantPool is the culprit, need to
            make it so, such that the GC will be effective.
            Show
            ksrini Kumar Srinivasan added a comment - BT2:EVALUATION Right the static HashMaps in the ConstantPool is the culprit, need to make it so, such that the GC will be effective.

              People

              • Assignee:
                ksrini Kumar Srinivasan
                Reporter:
                ndcosta Nelson Dcosta
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: