Saturday, April 20, 2013

jni jnienv PopLocalFrame example c c++ java


PopLocalFrame

jobject PopLocalFrame(JNIEnv *env, jobject result);
Pops off the current local reference frame, frees all the local references, and returns a local reference in the previous local reference frame for the given result object.
Pass NULL as result if you do not need to return a reference to the previous frame (PopLocalFrame)
LINKAGE:
Index 20 in the JNIEnv interface function table.
SINCE:
JDK/JRE 1.2


Example - PopLocalFrame

 #define N_REFS ... /* the maximum number of local references
                       used in each iteration */
 for (i = 0; i < len; i++) {
     if ((*env)->PushLocalFrame(env, N_REFS) < 0) {
         ... /* out of memory */
     }
     jstr = (*env)->GetObjectArrayElement(env, arr, i);
     ... /* process jstr */
     (*env)->PopLocalFrame(env, NULL);
 }