M
Mr T
JVM 1.3.1
We produce a system that relies on JNI to access legacy code. The JNI
code runs OK on Solaris 8, AIX, HP-UX and Linux.
When we run it on Solaris 9 we get problems.
I've narrowed the problem down to simply calling free()!
When it's called from JNI code we get a SIG 11 in realloc() on the
return.
The JNI code is very simple:
-------------------------------------------------
#define RESDEBUG(s) fflush(stderr);fprintf( stderr, "(%s %ld) - %s\n",
__FILE__, __LINE__, s )
JNIEXPORT jstring JNICALL
Java_com_company_product_package_classname_methodname(
JNIEnv * pEnv,
jclass jcls,
jstring jstrValueName )
{
RESDEBUG("JNI Checkpoint ENTER");
RESDEBUG("JNI Checkpoint: Calling calloc(1,10)");
char *ptr = (char*)calloc( 1, 10 );
RESDEBUG("JNI Checkpoint: Called calloc(1,10)");
// RESDEBUG("JNI Checkpoint: Calling free(ptr)");
// free( ptr );
// RESDEBUG("JNI Checkpoint: Called free(ptr)");
RESDEBUG("JNI Checkpoint EXIT");
return NULL;
}
-------------------------------------------------
Uncomment the free() and it cores!
(jniutils.cpp 16) - JNI Checkpoint ENTER
(jniutils.cpp 18) - JNI Checkpoint: Calling calloc(1,10)
(jniutils.cpp 20) - JNI Checkpoint: Called calloc(1,10)
(jniutils.cpp 22) - JNI Checkpoint: Calling free(ptr)
(jniutils.cpp 24) - JNI Checkpoint: Called free(ptr)
(jniutils.cpp 26) - JNI Checkpoint EXIT
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xff2c34cc
Function name=realloc
Library=/usr/lib/libc.so.1
Current Java thread:
at testThread.run(testThread.java:35)
Can anyone help?
Is it the runtime libraries or the way we build to deploy on Solaris 9?
TIA
Simon Temple
UK.
We produce a system that relies on JNI to access legacy code. The JNI
code runs OK on Solaris 8, AIX, HP-UX and Linux.
When we run it on Solaris 9 we get problems.
I've narrowed the problem down to simply calling free()!
When it's called from JNI code we get a SIG 11 in realloc() on the
return.
The JNI code is very simple:
-------------------------------------------------
#define RESDEBUG(s) fflush(stderr);fprintf( stderr, "(%s %ld) - %s\n",
__FILE__, __LINE__, s )
JNIEXPORT jstring JNICALL
Java_com_company_product_package_classname_methodname(
JNIEnv * pEnv,
jclass jcls,
jstring jstrValueName )
{
RESDEBUG("JNI Checkpoint ENTER");
RESDEBUG("JNI Checkpoint: Calling calloc(1,10)");
char *ptr = (char*)calloc( 1, 10 );
RESDEBUG("JNI Checkpoint: Called calloc(1,10)");
// RESDEBUG("JNI Checkpoint: Calling free(ptr)");
// free( ptr );
// RESDEBUG("JNI Checkpoint: Called free(ptr)");
RESDEBUG("JNI Checkpoint EXIT");
return NULL;
}
-------------------------------------------------
Uncomment the free() and it cores!
(jniutils.cpp 16) - JNI Checkpoint ENTER
(jniutils.cpp 18) - JNI Checkpoint: Calling calloc(1,10)
(jniutils.cpp 20) - JNI Checkpoint: Called calloc(1,10)
(jniutils.cpp 22) - JNI Checkpoint: Calling free(ptr)
(jniutils.cpp 24) - JNI Checkpoint: Called free(ptr)
(jniutils.cpp 26) - JNI Checkpoint EXIT
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0xff2c34cc
Function name=realloc
Library=/usr/lib/libc.so.1
Current Java thread:
at testThread.run(testThread.java:35)
Can anyone help?
Is it the runtime libraries or the way we build to deploy on Solaris 9?
TIA
Simon Temple
UK.