问题描述
我知道这可能是Android的一个基本问题。但是,什么是Dalvik的和达尔维克缓存?
I know this may be a basic question in Android. But what is Dalvik and dalvik-cache?
推荐答案
的Dalvik是用于Android的虚拟机。人们普遍认为是Java虚拟机,虽然这不是precisely正确的。它使用一个对象模型,等同于Java和它的内存模型也几乎相等。但Dalvik虚拟机为基础的虚拟机,而不是Java的虚拟机的寄存器,是基于栈。
Dalvik is the virtual machine that is used by Android. It is generally thought of as a java virtual machine, although this is not precisely correct. It uses an object model that is identical to java, and it's memory model is also nearly equivalent. But the dalvik VM is a register based VM, as opposed to java VMs, which are stack based.
因此,它采用了完全不同的字节code比Java。但是,Android SDK中包含的 DX工具的翻译Java字节code到的Dalvik字节code,这就是为什么你能在Java编写Android应用程序。
Accordingly, it uses a completely different bytecode than java. However, the Android SDK includes the dx tool to translate java bytecode to dalvik bytecode, which is why you are able to write Android applications in java.
当你说的的Dalvik缓存的,我想你指的是 /数据/达尔维克缓存目录,可以在典型的Android设备中找到。当您安装在Android上的应用程序,它执行一些修改和优化上的应用程序的DEX文件(包含所有的Dalvik字节code应用程序的文件)。然后,它会缓存所产生的ODEX(优化DEX 的)文件中的 /数据/达尔维克缓存目录,使其不必每次都进行优化的过程中,它加载应用程序。
When you say "dalvik-cache", I assume you mean the /data/dalvik-cache directory that can be found on typical Android devices. When you install an application on Android, it performs some modifications and optimizations on that application's dex file (the file that contains all the dalvik bytecode for the application). It then caches the resulting odex (optimized dex) file in the /data/dalvik-cache directory, so that it doesn't have to perform the optimization process every time it loads an application.
这篇关于什么是Dalvik的和达尔维克缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!