I could not figure out if I need to use DeleteLocalRef() on objects that are created when I call java code from C/C++. Consider the following pseudo code example:
void foo( char * string )
{
jstring jstr = env->NewStringUTF(string );
env->CallVoidMethod( ..., jstr);
env->DeleteLocalRef( .. jstr ); // <-- IS THIS NEEDED TO AVOID LEAKS ?
}
The JNI documentation mentions that it is usually not necessary to use DeleteLocalRef() when calling from Java to native. The JVM uses local references the are released after the call. But I could not find an answer for the native -> Java calling direction.
/ HaJU
Edited by: Haju_schulz on Mar 1, 2008 3:16 AM