FollowReferences function with null initial_object traverse objects starting from "heap roots". Hep roots includes "set of system classes", and the classes are reported with reference kind JVMTI_HEAP_REFERENCE_SYSTEM_CLASS.
Actually a lot of non-class objects are reported as JVMTI_HEAP_REFERENCE_SYSTEM_CLASS - java.lang.Module and [Ljava.lang.Object;
To reproduce:
implement JVMTI agent which calls FollowReferences with jvmtiHeapReferenceCallback:
heap_reference_callback(jvmtiHeapReferenceKind reference_kind,
const jvmtiHeapReferenceInfo* reference_info,
jlong class_tag,
jlong referrer_class_tag,
jlong size,
jlong* tag_ptr,
jlong* referrer_tag_ptr,
jint length,
void* user_data) {
if (reference_kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
*tag_ptr = 1;
}
return JVMTI_VISIT_OBJECTS;
}
And then call GetObjectsWithTags for objects with tag 1.
returned array contains a lot of non-class objects
Actually a lot of non-class objects are reported as JVMTI_HEAP_REFERENCE_SYSTEM_CLASS - java.lang.Module and [Ljava.lang.Object;
To reproduce:
implement JVMTI agent which calls FollowReferences with jvmtiHeapReferenceCallback:
heap_reference_callback(jvmtiHeapReferenceKind reference_kind,
const jvmtiHeapReferenceInfo* reference_info,
jlong class_tag,
jlong referrer_class_tag,
jlong size,
jlong* tag_ptr,
jlong* referrer_tag_ptr,
jint length,
void* user_data) {
if (reference_kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
*tag_ptr = 1;
}
return JVMTI_VISIT_OBJECTS;
}
And then call GetObjectsWithTags for objects with tag 1.
returned array contains a lot of non-class objects
- links to
-
Review(master)
openjdk/jdk/28224