The Absolute Must: Always Pair NewGlobalRef with DeleteGlobalRef

JNI global references are not garbage collected by the JVM; every `NewGlobalRef` call must have a corresponding `DeleteGlobalRef` to prevent persistent Java object leaks and eventual `OutOfMemoryError` exceptions.

Sources

Open the full topic