Understanding safe access of JNI arguments
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm doing some research regarding how HotSpot performs garbage-collection and/or heap-compaction while JNI code is running. It appears to be common knowledge that objects could be moved at any time in Java. I'm trying to understand, definitively if JNI is subject to effects garbage-collection. There exist a number of JNI functions to explicitly prevent garbage-collection; such as GetPrimitiveArrayCritical . It makes sense that such a function exists if the references are indeed volatile. However, it makes no sense if they are not. There