下面這些function 需要自己release reference, 不能仰賴vm去回收
1. FindClass:
jclass cls = env->FindClass("java/lang/ String");
env->DeleteLocalRef(cls);1. FindClass:
jclass cls = env->FindClass("java/lang/
2. NewString/ NewStringUTF/NewObject/
jstring str = env->NewStringUTF(const char*);
env->DeleteLocalRef(str);
env->DeleteLocalRef(str);
3. GetObjectField/GetObjectClass/
jclass ref = env->GetObjectClass(robj);
env->DeleteLocalRef(str);
4. GetByteArrayElements:
jbyte* array = env->GetByteArrayElements(
env->ReleaseByteArrayElements(
5. GetStringUTFChars/GetStringCha
const char* input = env->GetStringUTFChars(jinput, &isCopy);
env->ReleaseStringUTFChars(
6. NewGlobalRef:
jobject ref= env->NewGlobalRef(customObj);
env->DeleteGlobalRef(