Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6723450

-verbose:jni or -Xcheck:jni do not report excessive local reference usage.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 5.0
    • hotspot
    • generic
    • generic

      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.

            dsimms David Simms
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: