Any Android JNI developer should be familiar with this wonderful message in logcat. My question is: how can I tell the VM to dump current table state? I need it for debugging purposes to make sure that native threads at exit have no outstanding local references.
Full credit to Pavel, but I thought others might like the example code:
jclass vm_class = env->FindClass("dalvik/system/VMDebug");
jmethodID dump_mid = env->GetStaticMethodID( vm_class, "dumpReferenceTables", "()V" );
env->CallStaticVoidMethod( vm_class, dump_mid );
In case somebody needs to do something similar, you can use dumpReferenceTables from dalvik.system.VMDebug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With