Created
December 15, 2021 17:00
-
-
Save rocka/c72e5e192ec8ced57d050cc7ae0d220b to your computer and use it in GitHub Desktop.
dump JNI local reference table in Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://stackoverflow.com/questions/13283649/android-jni-local-reference-table-dump-current-state | |
fun dumpReferenceTables() { | |
try { | |
Class.forName("dalvik/system/VMDebug").run { | |
val dumpReferenceTables = getDeclaredMethod("dumpReferenceTables") | |
val constructor = getDeclaredConstructor() | |
constructor.isAccessible = true | |
dumpReferenceTables.invoke(constructor.newInstance()) | |
} | |
} catch (e: Exception) { | |
Log.i("VMDebug", e.message ?: "") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment