Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JNI:Solaris 9-Signal 11 in realloc()

Reply
Thread Tools

JNI:Solaris 9-Signal 11 in realloc()

 
 
Mr T
Guest
Posts: n/a
 
      11-19-2003
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_methodn ame(

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 1 - 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments