On Fri, 28 Aug 2026 18:33:27 GMT, Dan Heidinga <[email protected]> wrote:

>>> @AlanBateman you are right that heapdump and followrefs tools will not 
>>> visit the class after visiting the class loader with this change. They'll 
>>> still visit the class loader with the class. I'm still trying to work out 
>>> how to describe this change in behavior for these tools and maybe have a 
>>> CSR for it. There was only one test left that failed because of this change 
>>> - was hoping some hprof test would fail so I could see the effect of that. 
>>> I'm still working on this though, but I wanted to publicize the change 
>>> first.
>> 
>> I worry this is a significant behavior change that will blind some heap 
>> analysis tools.  As part of "I'm still working on this", would you mind 
>> looking into synthesizing these refs so that tools using FollowReferences 
>> will follow refs to the loaded classes?
>
>> I worry this is a significant behavior change that will blind some heap 
>> analysis tools. As part of "I'm still working on this", would you mind 
>> looking into synthesizing these refs so that tools using FollowReferences 
>> will follow refs to the loaded classes?
> 
> Rather than relying on the ArrayList of Class objects in ClassLoader to 
> provide the reference links, can we update the  `VM_HeapWalkOperation` used 
> by JVMTI FollowReferences to treat ClassLoaders specially?
> 
> The `VM_HeapWalkOperation::visit` operation in jvmtiTagMap.cpp can add a case 
> for classloaders to iterate them specially:
> 
> if (klass->is_class_loader_instance_klass()) {
>    return iterate_over_classloader(o);
> }
> 
> where `iterate_over_classloader` fetches the ClassLoaderData and then 
> iterates over its _klasses?

I don't think we should be changing behaviour here. I think calling 
`FollowReferences` from a ClassLoader instance should continue to report all 
classes loaded by that loader. This behaviour is too long-standing to just 
change it now. As @DanHeidinga  suggested we need to update the 
`FollowReferences` implementation so that it still returns the loaded classes.

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

PR Comment: https://git.openjdk.org/jdk/pull/32519#issuecomment-5503162834

Reply via email to