android开发者在移植第三方native库时,经常会使用到jni.
Java Native Interface(java本地接口),用于java与c/c++代码进行交互.需要了解的是,jni只是jvm的一个规范,各家虚拟机有各自的实现,本文分享一下dalvik中jobject reference的实现.

jobject reference type

jni规范中,对jobject定义了两种reference类型:

  • 全局引用(global reference)
  • 局部引用(local reference)

在JNI Specification中的说明是:

Local references are valid for the duration of a native method call, and are automatically freed after the native method returns. Global references …


查看全文
Posted by zhengwen