M
MikL
Hi all,
I've written a Windows EXE to launch the JVM, which it does very nicely. It
runs an application that uses Hypersonic and Spin. However when the
application exits via System.exit(), I've found resources (eg. JARs and the
EXE) are remaining locked, and memory is remaining allocated even though the
application disappears. According to the launcher's log file, the launcher
program itself appears to be hanging on the call to DestroyJavaVM.
Any suggestions?
The snippet of code where it's occurring:
log("running..");
(*vEnv)->CallStaticVoidMethod(vEnv,vMainClass,vMain,vMainArgs);
if ((*vEnv)->ExceptionOccurred(vEnv))
(*vEnv)->ExceptionDescribe(vEnv);
// I've tried it with and without the following 3 lines of code.
if ((*vVm)->DetachCurrentThread(vVm) != 0)
Raise(&ELauncher,"Could not detach main thread");
log("detached main thread");
if (vVm != NULL)
{
log("destroying JVM"); // <---- this message is logged
(*vVm)->DestroyJavaVM(vVm);
log("JVM destroyed"); // <---- this message is NOT logged.
}
else
log("no JVM to destroy");
I've written a Windows EXE to launch the JVM, which it does very nicely. It
runs an application that uses Hypersonic and Spin. However when the
application exits via System.exit(), I've found resources (eg. JARs and the
EXE) are remaining locked, and memory is remaining allocated even though the
application disappears. According to the launcher's log file, the launcher
program itself appears to be hanging on the call to DestroyJavaVM.
Any suggestions?
The snippet of code where it's occurring:
log("running..");
(*vEnv)->CallStaticVoidMethod(vEnv,vMainClass,vMain,vMainArgs);
if ((*vEnv)->ExceptionOccurred(vEnv))
(*vEnv)->ExceptionDescribe(vEnv);
// I've tried it with and without the following 3 lines of code.
if ((*vVm)->DetachCurrentThread(vVm) != 0)
Raise(&ELauncher,"Could not detach main thread");
log("detached main thread");
if (vVm != NULL)
{
log("destroying JVM"); // <---- this message is logged
(*vVm)->DestroyJavaVM(vVm);
log("JVM destroyed"); // <---- this message is NOT logged.
}
else
log("no JVM to destroy");