Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI's ReleaseStringUTFChars

843829May 20 2008 — edited May 20 2008
Is it necessary to call ReleaseStringUTFChars() if I have made a call to GetStringUTFChars() ?

say I have something like this:
FUNC(JNIEnv *env, jobject jObj,  jstring jDeviceName)
{
const char* deviceName = env->GetStringUTFChars(jDeviceName, NULL);

}
If I don't call ReleaseStringUTFChars() will the memory obtained for deviceName not be freed even after we exit the native function?
deviveName is a local/auto pointer. So once the function is exited, the varible is pushed off the stack and the memory it pointed to is freed right?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 17 2008
Added on May 20 2008
1 comment
526 views