Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Dalvik and dalvik-cache?

Tags:

android

dalvik

I know this may be a basic question in Android. But what is Dalvik and dalvik-cache?

like image 570
Android Killer Avatar asked Sep 24 '11 19:09

Android Killer


People also ask

What is Dalvik and cache?

Dalvik is the java based Virtual Machine that runs Android Apps on Android. Dalvik-cache is the cache area for Dalvik VM, it is created when the Dalvik VM optimizes your app for running. You can look up more on the internet about the differences between Dalvik VM op-codes and a "normal" Java VM Op-codes if you want.

Should I wipe Dalvik cache?

No. Wiping dalvik cache on your phone won't delete your apps or data. Clearing DALVIK CACHE will slower the loading of apps just once and smoothen the overall performance. Cached data is nothing to do with your primary data, so even if you delete all cache of your phone none of the data of your apps will get affected.

What is Dalvik system?

Dalvik is a discontinued process virtual machine (VM) in Android operating system that executes applications written for Android. (Dalvik bytecode format is still used as a distribution format, but no longer at runtime in newer Android versions.)

What does clearing Dalvik cache do Android?

The dalvik is is loaded once, and then never again (unless you wipe the dalvik cache, in which case, it is rebuilt upon reboot). There is no affect on any given program when the dalvik cache is wiped, other than starting slower the first time it is started after the wipe.


2 Answers

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 its memory model is also nearly equivalent. But the dalvik VM is a register based VM, as opposed to Java VMs, which are stack based.

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.

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.

good reference

like image 77
JesusFreke Avatar answered Oct 04 '22 02:10

JesusFreke


Dalvik is the java based Virtual Machine that runs Android Apps on Android. Dalvik-cache is the cache area for Dalvik VM, it is created when the Dalvik VM optimizes your app for running.

You can look up more on the internet about the differences between Dalvik VM op-codes and a "normal" Java VM Op-codes if you want.

like image 25
omermuhammed Avatar answered Oct 04 '22 04:10

omermuhammed