简体   繁体   English

Android 中的运行时类是什么?

[英]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: java.lang.Runtime 类的 android文档对JVM 进行了多次引用,例如调用freeMemory()方法:

Returns the amount of free memory in the Java Virtual Machine.返回 Java 虚拟机中的可用内存量。

Yet in recent versions of android there is no virtual machine.然而,在最新版本的 android 中,没有虚拟机。 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 .如果我没记错的话,这就是Runtime::freememory()方法在平台级别调用的内容: https Runtime::freememory() 。 0_r51/openjdkjvm/OpenjdkJvm.cc#297然后调用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.如果您想深入了解它的最底层,您可以继续挖掘,但 ART 似乎正试图为调用应用程序提供一个有效值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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