I tried to use setprop libc.debug.malloc = 1 to find out leak. I made an demo program and introduced memory leak in that but the above flag is not able to detect this leak. I tried below commands: adb shell setprop libc.debug.malloc 1 adb shell stop adb shell start
jstring Java_com_example_hellojni_HelloJni_stringFromJNI(JNIEnv* env,
jobject thiz) {
int *p = malloc(sizeof(int));
p[1] = 100;
return (*env)->NewStringUTF(env, "Hello from JNI !");
}
Any help would be appreciated.
Thanks