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

Instrumentation.redefineClasses() leaks class bytes

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      5.0
    • Introduced In Version:
      5.0
    • Resolved In Build:
      b21
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Backports

        Description

        java.lang.instrument.Instrumentation.redefineClasses() leaks
        class bytes for the redefined class or classes.

        As part of the work on this bug, the following SDK/JDK test
        will be added:

            java/lang/instrument/RedefineBigClass.sh
        The attached RedefineBigClass.server.jtr.00 tells the tale
        for the Server VM on Solaris X86. Version info is:

        java version "1.6.0_29"
        Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
        Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)


        Here is trace info for the first RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=323700K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=321536K)
        RedefineClasses-0x1: redefined name=BigClass, count=1 (avail_mem=321504K)


        Here is trace info for the last RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=106516K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=106456K)
        RedefineClasses-0x1: redefined name=BigClass, count=1000 (avail_mem=106456K)


        Here's the math for leak:

        321504 - 106456
        215048
        . / 1024
        210.0078
        . / 1024
        .2050

        Don't know why but the Server VM leaked way less than the Client VM
        in this run.
        The attached RedefineBigClass.client.jtr.00 tells the tale
        for the Client VM on Solaris X86. Version info is:

        java version "1.6.0_29"
        Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
        Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode)


        Here is trace info for the first RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=1185256K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=1184172K)
        RedefineClasses-0x1: redefined name=BigClass, count=1 (avail_mem=1184140K)


        Here is trace info for the last RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=138252K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=138252K)
        RedefineClasses-0x1: redefined name=BigClass, count=1000 (avail_mem=138252K)


        Here's the math for leak:

        1184140 - 138252
        1045888
        . / 1024
        1021.3750
        . / 1024
        .9974

        So we leaked almost 1GB in 1000 RedefineClasses() calls.
        I did another Server VM run:

        Here is trace info for the first RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=1767152K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=1764988K)
        RedefineClasses-0x1: redefined name=BigClass, count=1 (avail_mem=1764956K)


        Here is trace info for the last RedefineClasses() call:

        RedefineClasses-0x1: loading name=BigClass (avail_mem=640444K)
        RedefineClasses-0x1: loaded name=BigClass (avail_mem=640388K)
        RedefineClasses-0x1: redefined name=BigClass, count=1000 (avail_mem=640388K)


        Here's the math:

        1764956 - 640388
        1124568
        . / 1024
        1098.2109
        . / 1024
        1.0724

        So we leaked more than 1GB in 1000 RedefineClasses() calls.
        Not sure at all what happened in the other Server run.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dcubed Daniel Daugherty
                Reporter:
                dcubed Daniel Daugherty
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: