Linked by Thom Holwerda on Tue 10th Jul 2012 17:08 UTC
PDAs, Cellphones, Wireless I've been flashing CyanogenMod 9 nightlies for months now, and the process to do so has become pretty much muscle memory at this point (if cwm ever changes its menu order I'm screwed). One step of this process has always fascinated me simply because I have no idea what exactly it does and why I have to do it: clearing Dalvik cache.
Thread beginning with comment 526233
To read all comments associated with this story, please click here.
Comment by anevilyak
by anevilyak on Tue 10th Jul 2012 17:15 UTC
anevilyak
Member since:
2005-09-14

My understanding of it is that in the process of installing an Android app onto a particular device, various optimizations are made to its Java class files in order to perform more efficiently on the particular hardware contained in that device. These optimized variants are stored in the cache so they don't need to be recomputed each time (along with any JIT optimizations that are made as a result of runtime analysis of the program after you've run it a few times). Since the bytecode format can change between Android versions, that cache would potentially need to be cleared to force all that to be regenerated in the newer format.

Reply Score: 14

RE: Comment by anevilyak
by fatjoe on Tue 10th Jul 2012 18:19 in reply to "Comment by anevilyak"
fatjoe Member since:
2010-01-12

The word you are searching for is AOT compilation cache.

(the android cache partition also contains some data)

Reply Parent Score: 4

RE[2]: Comment by anevilyak
by anevilyak on Tue 10th Jul 2012 20:24 in reply to "RE: Comment by anevilyak"
anevilyak Member since:
2005-09-14

Will try to remember that, thanks!

Reply Parent Score: 2

RE[2]: Comment by anevilyak
by JAlexoid on Wed 11th Jul 2012 13:20 in reply to "RE: Comment by anevilyak"
JAlexoid Member since:
2009-05-19

Not necessarily. Dalvik doesn't do AOT compilation. It does do resource optimization and layout formats.

Reply Parent Score: 3

RE: Comment by anevilyak
by Thom_Holwerda on Tue 10th Jul 2012 19:54 in reply to "Comment by anevilyak"
Thom_Holwerda Member since:
2005-06-29

Thanks for the clear answer, Rene!

Reply Parent Score: 2

RE[2]: Comment by anevilyak
by galvanash on Tue 10th Jul 2012 23:43 in reply to "RE: Comment by anevilyak"
galvanash Member since:
2006-01-25

Thanks for the clear answer, Rene!


If you want a more nitty gritty detailed explanation, read this:

http://www.netmite.com/android/mydroid/dalvik/docs/dexopt.html

Also, just fyi - this is the stuff a large chunk of the Oracle patent lawsuit was about... Namely whether dexopt was violating Oracle's patent on dynamic optimizations. The end result of what they were arguing about is what ends up in the dalvik cache.

Reply Parent Score: 4