2 Replies Latest reply on Mar 24, 2009 5:35 PM by alanb

    JVMTI 1.1 FollowReferences: traversing the whole heap if object specified?

      I am using the JVMTI call FollowReferences to find all objects (and their sizes) referenced by a single object, by specifying initial_object in the call "jvmtiError FollowReferences(jvmtiEnv* env, jint heap_filter, jclass klass, jobject initial_object, const jvmtiHeapCallbacks* callbacks, const void* user_data)".

      The object passed in is a valid object, but tracing through my callback function (only using jvmtiHeapReferenceCallback), it seams that pretty much all of the heap's objects are traversed, no matter if they are directly or indirectly referenced by my object or not. That seems to contradict the spec: "This function initiates a traversal over the objects that are directly and indirectly reachable from the specified object ". And that's exactly what I'm trying to accomplish so I don't have the overhead of traversing the whole heap. Is there anything I am missing, or are there some other parameters to be set?

      JVM version (on Windows XP): java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)