Duplicate :
|
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.