Optimize GC with NewWeakGlobalRef for Non-Blocking Object Access

Employ `NewWeakGlobalRef` when a native reference should not prevent the Java object from being garbage collected, but always remember to promote it to a strong reference (e.g., via `NewLocalRef`) before use and explicitly free it with `DeleteWeakGlobalRef` afterwards.

Sources

Open the full topic