Am I a little confused about the objects that are passed to c from java? Should they be deleted inside their own jni method or will they collect garbage when the method returns. For example:
if I have my own declaration in my java file public native printString(String msg); , and the native method uses const char *message = (jni_env)->GetStringUTFChars(msg, &iscopy); to get the c-style character array. Shoud I call (jni_env)->ReleaseStringUTFChars(msg, message); after doing all the material in your own method. If so, why is this needed? Why doesn't the Java runtime do this on behalf of the programmer? After the string has been declared and passed from the java environment.
gmuhammad
source share