[JNI] java.lang.OutOfMemoryError

L

Lars Geldner

Hi,

I'm calling a c++-native function from java to get some data from a DLL.
The C++-function:

void JNICALL Java_com_ndsatcom_gui_gims_GIMSAdapter__1gmShowDiag
(JNIEnv *env, jobject obj, jstring netName, jstring networkID)
{
GIMFINDRECEX findRec;
gmSetFindEx(&findRec, "", "", "MC", "E", "C", "1", "", SACO_DIAG,
"090500085");
int findFlag;
int findRes = gmFindDiagEx(NULL, &findRec, &findFlag);
int bSize = gmGetDiagDataEx(NULL, &findRec);
}

The gmGetDiagDataEx-function allocates the needed memory buffer to store
a block of data. If a run the code I'm getting a java.lang.OutOfMemoryError:

java.lang.OutOfMemoryError
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : unknown exception code (0xe06d7363) occurred at
PC=0x77E9B2F
0
Function=RaiseException+0x56
Library=C:\WINNT\system32\KERNEL32.dll
[...]

Any suggestions are welcome.

TIA,

Lars Geldner
 
G

Gordon Beaton

I'm calling a c++-native function from java to get some data from a
DLL. The C++-function:

void JNICALL Java_com_ndsatcom_gui_gims_GIMSAdapter__1gmShowDiag
(JNIEnv *env, jobject obj, jstring netName, jstring networkID)
{
GIMFINDRECEX findRec;
gmSetFindEx(&findRec, "", "", "MC", "E", "C", "1", "", SACO_DIAG,
"090500085");
int findFlag;
int findRes = gmFindDiagEx(NULL, &findRec, &findFlag);
int bSize = gmGetDiagDataEx(NULL, &findRec);
}

The gmGetDiagDataEx-function allocates the needed memory buffer to store
a block of data. If a run the code I'm getting a java.lang.OutOfMemoryError:

java.lang.OutOfMemoryError
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : unknown exception code (0xe06d7363) occurred at
PC=0x77E9B2F
0
Function=RaiseException+0x56
Library=C:\WINNT\system32\KERNEL32.dll
[...]

Any suggestions are welcome.

The code you've posted really doesn't help solve the problem, which is
more than likely in one of the mystery functions you call from the
native method. Try reducing the code to a short but self-contained
example that that still has the problem, and post that.

How much memory are you allocating, and do you check the return value
from malloc (or equiv)?

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top