Should I call PushLocalFrame and PopLocalFrame when I call Java Method From C++?

Viewed 3341

Question 1: I have a java class with a static method:

class Test {
    static public void show (String value) {
        // dosomething with value 
    }
}

If I want call it from c++:

jstring value = env->NewStringUTF("Hello, World");
// ExceptionCheck after NewStringUTF.
env->CallStaticVoidMethod(the_jclass, the_jmethodID, value);
// ExceptionCheck after CallStaticVoidMethod.

Should I put PushLocalFrame before NewStringUTF and put PopLocalFrame after CallStaticVoidMethod to release local references?

Question 2:

I see the declaration of PopLocalFrame, it's:

jobject PopLocalFrame(JNIEnv *env, jobject result);

After reading the jni documents, I still can't understand why PopLocalFrame needs a result parameter and a return value. Could you give me a example to show it's existence value?

1 Answers
Related