I'm using the JNI invocation API, which starts a JVM within a C program; in this situation, you get a JNIEnv pointer which remains valid until you explicitly destroy the JVM. Does the local/global distinction still apply here? What's the meaning of a local reference to a newly created object, since the JNIEnv remains in scope all the time?
A:
I think the thread which created JVM becomes Java thread, which, like any thread created in Java, or attached via AttachCurrentThread(), has its local stack frame. So any object you create, becomes a local reference in this stack frame, which will expire when you destroy JVM (you can't detach main thread), or call DeleteLocalRef().
Xeor
2010-10-12 20:38:04
Do you have any documentation reference on this? And is it legal to pass such local references to other JNIEnv obtained when Java makes a native C call?
Flavio
2010-10-14 13:15:43