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!

JVM crashed at ReleaseStringUTFChars

843829Apr 24 2003 — edited May 19 2005
I have a simple JNI program to print out some Java
Strings as follows:
JNIEXPORT void JNICALL Java_Logger_logDebug
(JNIEnv *env, jobject msg, jstring strC, jstring strM, jstring str1, jstring str2)
{
jboolean isCopy1, isCopy2;
jboolean isCopyC, isCopyM;

const char* c_strC = env->GetStringUTFChars(strC, &isCopyC);
const char* c_strM = env->GetStringUTFChars(strM, &isCopyM);

const char* c_str1 = env->GetStringUTFChars(str1, &isCopy1);
const char* c_str2 = env->GetStringUTFChars(str2, &isCopy2);

FLXUX_DLOG("%s::%s [%s] %s\n",c_strC, c_strM, c_str1, c_str2);

if( isCopyC)
env->ReleaseStringUTFChars(strC, c_strC);
if( isCopyM )
env->ReleaseStringUTFChars(strM, c_strM);
if( isCopy1)
env->ReleaseStringUTFChars(str1, c_str1);
if( isCopy2)
env->ReleaseStringUTFChars(str2, c_str2);
}

Sometimes JVM crashed at
env->ReleaseStringUTFChars(strC, c_strC);

Any possible reasons?
Thanks,
Charles
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2005
Added on Apr 24 2003
2 comments
327 views