JDK-4257193 : JPDA: Provide a way to prevent immediate GC of unreferenced objects
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.3.0,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1999-07-26
  • Updated: 2016-11-03
  • Resolved: 2016-11-03
Related Reports
Duplicate :  
Relates :  
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.

Comments
This is not on our list of current priorities, if this changes please re-open this issue.
03-11-2016

PUBLIC COMMENTS .
09-09-2004

EVALUATION See description. gordon.hirsch@eng 2000-02-18
18-02-2000