JNI中多次调用NewObject导致jvm崩溃
实现代码:
JNIEXPORT void JNICALL Java_com_xxx_yyy_newObjects (JNIEnv *env, jobject)
{
int len = 100;
for (int i = 0; i < len; i++)
{
jobject output = env->NewObject(g_OutIds.jCls, g_OutIds.mid_construct, "");
if (NULL == output)
{
std::cout << i << "\tNewObject(g_OutIds) failed" << std::endl;
}
else
{
std::cout << i << "\tNewObject(g_OutIds) succeeded" << std::endl;
}
}
}
每次都是在成功循环34次后,jvm崩溃。输出错误:
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00002b196fe93aca, pid=12073, tid=1080133952
#
# JRE version: 6.0_17-b04
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.3-b01 mixed mode linux-amd64 )
# Problematic frame:
# V [libjvm.so+0x3b8aca]
#
# An error report file with more information is saved as:
# Path/hs_err_pid12073.log
请各位高手指点