Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: arton Tajima
RE: unloading the jvm throws errors [ reply ]  
2013-01-10 12:10
Thanks for your comment.
It's not bad to warn message, or I think replacing no-op or raising NotImplementedError instead of releasing java class proxies.

By: Alex Porras
RE: unloading the jvm throws errors [ reply ]  
2013-01-09 17:34
Hello,

Thank you for your response. I have read the link you provided and did some searching online, and it looks like I have nothing useful I can offer as an alternative, other than perhaps catching an exception on close and printing a custom message to allude to the fact that the problem stems from JNI.

What do you think?

Cheers,

Alex

By: arton Tajima
RE: unloading the jvm throws errors [ reply ]  
2013-01-08 09:54
Hi

I've implemented Rjb::unload, but JVM/JRE doesn't support the feature according with http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#destroy_java_vm.
The document says "The JDK/JRE still does not support VM unloading, however".
So sadly, when calling Rjb::unload, JVM was dettached from the thread, but it doesn't unload, so the only result is : can't create jvm (becaues it still remains in the process).

I'll hope to hear your comment about what Rjb shoud do ?

By: Alex Porras
unloading the jvm throws errors [ reply ]  
2013-01-07 23:43
I am using RJB to run some java code from a third party jar. The code runs as expected. However, there seems to be a memory leak somewhere between the java code and the local ruby code.

Long term, I may go as far as profiling the Java code in segregation to see if the cause is there.

Short term, I was wondering if it was possible to unload the JVM on demand? I tried invoking Rjb::unload after running the code in the jar file I needed, but it throws errors, usually along the lines of not being able to call "close()" on certain objects, which varied randomly on each execution.

On occasions where Rjb::unload did work, subsequent Rjb::load calls would fail with "can't create Java VM" errors.

Any help would be appreciated.

Thanks!

--
version info:

mac os x mountain lion, 10.8.2

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]