1 Reply Latest reply on Sep 10, 2011 2:26 AM by EJP

    JRockit reuses local references when calling JVMTI event callbacks

      [At least] During VM startup, multiple calls to the ClassPrepare event handler are made using the same local reference for the thread parameter. If DeleteLocalReference is called before returning from the ClassPrepare event, working with the thread parameter passed to subsequent calls to ClassPrepare will crash the VM.

      While the JVMTI documentation is unclear about whether or not the user is allowed to delete local references sent as parameters to the event callbacks, this behavior does differ from the Sun Hotspot implementation and seems to violate the fundamental reason why local references are used for all values sent from the VM to native methods. The relevant line in the JVMTI specification is:
      Some JVM TI events identify objects with JNI references. All references in JVM TI events are JNI local references and will become invalid after the event callback returns.