Android JNI local reference table to dump the current state
•
Android
Any Android JNI developer should be familiar with this wonderful message in logcat. My question is: how do I tell VM to dump the current table status? I need it to debug to ensure that the native thread has no outstanding local references when exiting
resolvent:
Thanks entirely to Pavel, but I think others might like the sample code:
jclass vm_class = env->FindClass("dalvik/system/VMDebug");
jmethodID dump_mid = env->GetStaticMethodID( vm_class, "dumpReferenceTables", "()V" );
env->CallStaticVoidMethod( vm_class, dump_mid );
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码