Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ndk memory check
GetObjectClass -> DeleteLocalRef
FindClass -> DeleteLocalRef
NewString -> DeleteLocalRef
NewStringUTF -> DeleteLocalRef
NewObject -> DeleteLocalRef
NewBooleanArray -> DeleteLocalRef
NewByteArray -> DeleteLocalRef
NewCharArray -> DeleteLocalRef
NewShortArray -> DeleteLocalRef
NewIntArray -> DeleteLocalRef
NewLongArray -> DeleteLocalRef
NewFloatArray -> DeleteLocalRef
NewDoubleArray -> DeleteLocalRef
GetObjectField -> DeleteLocalRef
NewGlobalRef -> DeleteGlobalRef
NewWeakGlobalRef -> DeleteWeakGlobalRef
GetStringChars -> ReleaseStringChars
GetBooleanArrayElements -> ReleaseBooleanArrayElements
GetByteArrayElements -> ReleaseByteArrayElements
GetCharArrayElements -> ReleaseCharArrayElements
GetShortArrayElements -> ReleaseShortArrayElements
GetIntArrayElements -> ReleaseIntArrayElements
GetLongArrayElements -> ReleaseLongArrayElements
GetFloatArrayElements -> ReleaseFloatArrayElements
GetDoubleArrayElements -> ReleaseDoubleArrayElements
GetPrimitiveArrayCritical-> ReleasePrimitiveArrayCritical
GetStringCritical -> ReleaseStringCritical
GetStringUTFChars -> ReleaseStringUTFChars
CallObjectMethod need to ReleaseStringUTFChars(if GetStringUTFChars is called) and DeleteLocalRef
GetObjectArrayElement need to ReleaseStringUTFChars(if GetStringUTFChars is called) and DeleteLocalRef
don't sizeof(pointer)
check malloc/calloc result is NULL and remember free it
check memcpy source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment