The documentation for the JNI function NewGlobalRef
states:
Returns a global reference, or NULL if the system runs out of memory
However it is not clear to me, if when the function returns NULL
whether an OutOfMemoryError
exception has already been thrown by the JVM or not. The documentation does not say that an exception is thrown, if it is not do I need to throw that exception, or should I just return execution to the JVM from JNI?
The OOM exception will be thrown for you, you should not worry.