On Mon, 16 Mar 2026 01:55:58 GMT, David Holmes <[email protected]> wrote:

> Okay but when can these references be removed? What is the affect of never 
> removing them?

My assumption had been that eventually the debugger would release the ObjectID, 
which in turn would release globalref. See 
https://docs.oracle.com/en/java/javase/25/docs/specs/jdwp/jdwp-protocol.html#JDWP_VirtualMachine_DisposeObjects

However, it also says:

```Use of this command is not required. If it is not sent, resources associated 
with each ID will be freed by the back-end at some time after the corresponding 
object is garbage collected.```

So the DisposeObjects call is not guaranteed to happen, in which case the debug 
agent relies on detecting if the object is collected to decide if the ObjectID 
should be disposed of, but it won't be collected because of the global ref.

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/2229#issuecomment-4064867406

Reply via email to