what are weak global references ? How it is different from a global reference?
c, java, java-native-interface, weak-references
Solution
I think that the answer to your questions can be found here: http://java.sun.com/docs/books/jni/html/refs.html
As its written:
Local and global references have different lifetimes. Local references are automatically freed, whereas global and weak global references remain valid until they are freed by the programmer.
The difference between local references and global references is: the context
The local reference is just a local variable. The underlying object will be destroyed once you get out of its context (like returning from the native function that defined it).
Like global references, weak global references remain valid across native method calls and across different threads. Unlike global references, weak global references do not keep the underlying object from being garbage collected.
The difference between weak global references and global references is that the object referenced by the weak one can be garbaged collected if needed (in case of lack of memory).
Problem
What are weak global references in JNI ? How it is different from a global reference and a local reference ?