On Tue, 16 Nov 2021 02:45:13 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:

>> The nsk.share.jdi.TestClass1 is used via reflection. The reflective call 
>> creates MethodHandle and one more reference to TestClass1.  So the number of 
>> expected references should be incremented.  Thanks to @plummercj and 
>> @mlchung for the investigation.
>> This fix also prints references to inspected class.
>
> Leonid Mesnik has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   updated

The debugger doesn't show MemberName::clazz, but I could see it in heapdump. It 
seems because it doesn't have GC root and should be here by JDI spec.
And the MethodType is referred from 'static final 
ConcurrentWeakInternSet<MethodType> internTable = new 
ConcurrentWeakInternSet<>();’' from java/lang/invoke/MethodType.java.
See ref tree:
instance of java.lang.invoke.MethodType(id=883)
 instance of 
java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry(id=887)
  instance of java.util.concurrent.ConcurrentHashMap$Node(id=888)
   instance of java.util.concurrent.ConcurrentHashMap$Node[1024] (id=890)
    instance of java.util.concurrent.ConcurrentHashMap(id=892)
     instance of java.lang.invoke.MethodType$ConcurrentWeakInternSet(id=894)
      instance of java.lang.Class(reflected class=java.lang.invoke.MethodType, 
id=72)

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

PR: https://git.openjdk.java.net/jdk/pull/6402

Reply via email to