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

JPDA: Provide a way to prevent immediate GC of unreferenced objects

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0, 5.0
    • Fix Version/s: 10
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      For users of JDI and JDWP, there are cases where objects are returned which are not referenced anywhere in the target VM. At the JDI level, this is possible with the following methods:

      ArrayType.newInstance()
      VirtualMachine.mirrorOf(String)
      ClassType.newInstance()
      ClassType.invokeMethod()
      ObjectReference.invokeMethod()

      There is a small chance that the objects returned by any of these methods will be immediately garbage collected in the target VM before the client can do anything with them. It would be very helpful if there was an option that instructed the VM to disable garbage collection for these objects. For the invokeMethod calls and for ClassType.newInstance, one of the unused bits in the options integer can be used to specify this behavior. The other cases are less serious since the client can always cleanly recover, but it would be better if a boolean option were added to these methods to disable collection of the newly created object.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ghirschsunw Gordon Hirsch (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: