简体   繁体   中英

What Is The Runtime Class In Android?

The android documentation for the java.lang.Runtime class makes multiple reference to the JVM, for example calling the freeMemory() method:

Returns the amount of free memory in the Java Virtual Machine.

Yet in recent versions of android there is no virtual machine. What exactly does this method, and other similar methods, return?

If I'm not mistaken, this is what gets call at the platform level from the Runtime::freememory() method: https://android.googlesource.com/platform/art/+/refs/tags/android-9.0.0_r51/openjdkjvm/OpenjdkJvm.cc#297 which then calls https://android.googlesource.com/platform/art/+/refs/tags/android-9.0.0_r51/runtime/gc/heap.h#548 .

You can keep digging if you want to get to the very bottom of it, but it seems the ART is trying to provide a valid value to the calling app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM