Prevent JNI to be garbage collected
I'm working in a project where there is some java code that needs to call native code(with JNI). In the past, the program was doing the call to the native function, the native function then made some work and the control was back to the Java application.
Now, there is the need for this native code to keep running after the Java code ends. The reason is that the Java code needs a lot of memory, and we can´t keep the Java code in memory just to allow the native code to keep running.
Some idea? Thanks!