static void android_media_MediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
{
ALOGV("native_setup");
sp<MediaPlayer> mp = new MediaPlayer();
ALOGV("MEMORY LEAK - MediaPlayer");
char *MemoryLeak_MediaPlayer = (char *)malloc(100000);
if(mp == NULL) {
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
return;
}
// create new listener and give it to MediaPlayer
sp<JNIMediaPlayerListener> listener = new JNIMediaPlayerListener(env, thiz, weak_this);
mp->setListener(listener);
// Stow our new C++ MediaPlayer in an opaque field in the Java object.
setMediaPlayer(env, thiz, mp);
}
How to use VALGRIND to find out Memory Leak and Memory Corruption in Android Native Code? If anyone is using some other tool, please explain the procedure.