On Fri, 12 Jun 2026 08:01:46 GMT, Alan Bateman <[email protected]> wrote:

> > The first is to use WeakReferences instead of SoftReferences so the 
> > ObejctReferenceImpls are more readily collected
> 
> I assume this would be in conjunction with the pinning proposal rather than a 
> change in advance of pinning by default. Just thinking about it being 
> observable with more chance of ObjectCollectedException.

Setting the pinning proposal aside, a change to WeakReferences would not impact 
the rate at which we see ObjectCollectedException. That is result of debuggee 
side collection of the object, not debugger side collection of the 
ObjectReferenceImpl. The existence of a ObjectReferenceImpl mirror of a 
debuggee object in general does not prevent the debuggee object from being 
collected. You need to  also call disableCollection() to do that. However, the 
one somewhat corner case would be calling disableCollection() and then while in 
that state no longer referencing the ObjectReferenceImpl, allowing it to be 
collected and the ObjectID disposed of. That would result in object being 
unpinned, allowing it to be collected (if no other references in the debuggee). 
But since there is no longer an ObjectReferenceImpl, there is no way to trigger 
an ObjectCollectedException.

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

PR Comment: https://git.openjdk.org/jdk/pull/31421#issuecomment-4689694919

Reply via email to