JDK-6723450 : -verbose:jni or -Xcheck:jni do not report excessive local reference usage.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2008-07-08
  • Updated: 2014-05-15
  • Resolved: 2014-05-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
  From
http://java.sun.com/docs/books/jni/html/refs.html#27592

"Java 2 SDK release 1.2 supports a command-line option -verbose:jni. When this option is enabled, the virtual machine implementation reports excessive local reference creation beyond the reserved capacity."

This however doesn't hold true.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile a native class w/ code like:

jclass LocalRunnable;
for (int i = 0; i < 16; i  )
         jclass LocalRunnable = env->FindClass("java/lang/Runnable");

Run it.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Excessive local reference creation is reported.
ACTUAL -
Not reported.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
class LocalRefs {
public native byte run();
public static void main(String[] args) {
new LocalRefs().run();
}
}

JNIEXPORT jbyte JNICALL Java_LocalRefs_run
  (JNIEnv *env, jobject obj);

JNIEXPORT jbyte JNICALL Java_LocalRefs_run
  (JNIEnv *env, jobject obj)
{
jclass LocalRunnable;
for (int i = 0; i < 16; i  )
         jclass LocalRunnable = env->FindClass("java/lang/Runnable");
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Enforce strictly manually.

Comments
Note to self MAX_REASONABLE_LOCAL_CAPACITY, and JNI_ERR probably not the correct return code.
24-04-2014