I have the following code in a c++ "listener class" (more or less), which calls some function of a Java object. I suspect there's a memory leak:
JNIEnv *env = NULL;
vm_->AttachCurrentThread(&env, NULL);
const jclass cls = env->FindClass(...);
const jmethodID meth = env->GetMethodID(...);
const jobject obj = env->NewObject(cls, meth, ...);
[ more code ]
env->DeleteLocalRef(obj);
My question is: should I also release the local reference of cls and meth? JNI Documentation isn't very clear about it.