On Fri, 13 Mar 2026 19:31:35 GMT, Alex Menkov <[email protected]> wrote:

> Updated jdwp agent to not use weak references for value objects (use string 
> references instead)
> 
> testing: tier1,tier2,tier3,hs-tier5-svc with enable-preview

This might be fixable in commonRef_compact() by adding some special code for 
freeing value object nodes, but I'm not certain under which conditions they can 
be freed. The normal model for the debug agent is to maintain a weakref so the 
object can be collected, and then commonRef_compact() will detect that it has 
been collected and free the node. Value objects are flipping this around. We 
keep the value object alive with a strong ref and and now are stuck having to 
free the node in commonRef_compact() so the value object can be collected. I 
think it is safe to do this when the refcnt is 0, which it should almost always 
be. objectIds are only created in one place in outStream.c and are released 
once outStream.c has finished sending the reply packet to the debugger. 
Basically objectIDs are created and sent in replies but can become invalid 
(normally due to GC) before the debugger even has a chance to call 
DisableCollection() on them; a common headache for debuggers.

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

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

Reply via email to