AndroidJNI
- AllocObject
- AttachCurrentThread
- CallBooleanMethod
- CallByteMethod
- CallCharMethod
- CallDoubleMethod
- CallFloatMethod
- CallIntMethod
- CallLongMethod
- CallObjectMethod
- CallShortMethod
- CallStaticBooleanMethod
- CallStaticByteMethod
- CallStaticCharMethod
- CallStaticDoubleMethod
- CallStaticFloatMethod
- CallStaticIntMethod
- CallStaticLongMethod
- CallStaticObjectMethod
- CallStaticShortMethod
- CallStaticStringMethod
- CallStaticVoidMethod
- CallStringMethod
- CallVoidMethod
- DeleteGlobalRef
- DeleteLocalRef
- DetachCurrentThread
- EnsureLocalCapacity
- ExceptionClear
- ExceptionDescribe
- ExceptionOccurred
- FatalError
- FindClass
- FromBooleanArray
- FromByteArray
- FromCharArray
- FromDoubleArray
- FromFloatArray
- FromIntArray
- FromLongArray
- FromObjectArray
- FromReflectedField
- FromReflectedMethod
- FromShortArray
- GetArrayLength
- GetBooleanArrayElement
- GetBooleanField
- GetByteArrayElement
- GetByteField
- GetCharArrayElement
- GetCharField
- GetDoubleArrayElement
- GetDoubleField
- GetFieldID
- GetFloatArrayElement
- GetFloatField
- GetIntArrayElement
- GetIntField
- GetLongArrayElement
- GetLongField
- GetMethodID
- GetObjectArrayElement
- GetObjectClass
- GetObjectField
- GetShortArrayElement
- GetShortField
- GetStaticBooleanField
- GetStaticByteField
- GetStaticCharField
- GetStaticDoubleField
- GetStaticFieldID
- GetStaticFloatField
- GetStaticIntField
- GetStaticLongField
- GetStaticMethodID
- GetStaticObjectField
- GetStaticShortField
- GetStaticStringField
- GetStringField
- GetStringUTFChars
- GetStringUTFLength
- GetSuperclass
- GetVersion
- IsAssignableFrom
- IsInstanceOf
- IsSameObject
- NewBooleanArray
- NewByteArray
- NewCharArray
- NewDoubleArray
- NewFloatArray
- NewGlobalRef
- NewIntArray
- NewLocalRef
- NewLongArray
- NewObjectArray
- NewObject
- NewShortArray
- NewStringUTF
- PopLocalFrame
- PushLocalFrame
- SetBooleanArrayElement
- SetBooleanField
- SetByteArrayElement
- SetByteField
- SetCharArrayElement
- SetCharField
- SetDoubleArrayElement
- SetDoubleField
- SetFloatArrayElement
- SetFloatField
- SetIntArrayElement
- SetIntField
- SetLongArrayElement
- SetLongField
- SetObjectArrayElement
- SetObjectField
- SetShortArrayElement
- SetShortField
- SetStaticBooleanField
- SetStaticByteField
- SetStaticCharField
- SetStaticDoubleField
- SetStaticFloatField
- SetStaticIntField
- SetStaticLongField
- SetStaticObjectField
- SetStaticShortField
- SetStaticStringField
- SetStringField
- ThrowNew
- Throw
- ToBooleanArray
- ToByteArray
- ToCharArray
- ToDoubleArray
- ToFloatArray
- ToIntArray
- ToLongArray
- ToObjectArray
- ToReflectedField
- ToReflectedMethod
- ToShortArray
AndroidJNI.PushLocalFrame 压入局部帧
static function PushLocalFrame (capacity : int) : int
Description描述
Creates a new local reference frame, in which at least a given number of local references can be created.
创建一个新的局部引入帧,至少一个给定的局部引用可以被创建的数。
PushLocalFrame为一定数量的局部引用创建了一个使用堆栈,而PopLocalFrame负责销毁堆栈顶端的引用。
Push/PopLocalFrame函数对提供了对局部引用的生命周期更方便的管理。
在管理局部引用的生命周期中,Push/PopLocalFrame是非常方便的。你可以在本地函数的入口处调用PushLocalFrame,然后在出口处调用PopLocalFrame,这样的话,在函数对中间任何位置创建的局部引用都会被释放。而且,这两个函数是非常高效的。
如果你在函数的入口处调用了PushLocalFrame,记住在所有的出口(有return出现的地方)调用PopLocalFrame。
大量的局部引用创建会浪费不必要的内存。一个局部引用会导致它本身和它所指向的对象都得不到回收。尤其要注意那些长时间运行的方法、创建局部引用的循环和工具函数,充分得利用Pus/PopLocalFrame来高效地管理局部引用。
参见: Java Native Interface Specification (Oracle)
最后修改:2011年4月12日 Tuesday 15:11