Implement JNI listener.
Posted
by G B
on Stack Overflow
See other posts from Stack Overflow
or by G B
Published on 2010-03-08T09:15:04Z
Indexed on
2010/03/08
9:21 UTC
Read the original article
Hit count: 765
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.
© Stack Overflow or respective owner