What’s in the Dalvik cache?

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.

The process of upgrading CyanogenMod 9 nightlies for the Samsung Galaxy SII is pretty elementary, and basically, anyone can do it (hence even I never had it fail).

  1. Download latest nightly
  2. Transfer to device
  3. Reboot into cwm
  4. Install the nightly zip file
  5. Clear cache
  6. Clear Dalvik cache
  7. Reboot

This whole process takes only a few minutes, so I usually do it a few times a week. Now that CM9 has become a bit more mature, the improvements between each nightly have gotten smaller, so there’s no need to keep up with every single one of them anymore.



So, it’s step 6 that has me wondering. What exactly is happening when the Dalvik cache is cleared? Obviously, cached data is being removed, but what is in this cache? What is its function? Regular application data isn’t part of that particular cache, so I’m guessing it’s way more low-level than that. I have little to no knowledge on Java either, so I don’t really know what kind of cache a Java VM needs in order to function, and why it must be emptied when you move to a new nightly.

Searching the web reveals several forum posts on the issue, but nothing conclusive or truly informative – it usually devolves into a discussion about whether or not it’s even necessary in the first place. Do any OSNews readers have the answers to these questions in a more definitive sense?

23 Comments

  1. 2012-07-10 5:15 pm
    • 2012-07-10 6:19 pm
      • 2012-07-10 8:24 pm
      • 2012-07-11 1:20 pm
        • 2012-07-11 4:30 pm
    • 2012-07-10 7:54 pm
      • 2012-07-10 11:43 pm
  2. 2012-07-10 6:26 pm
    • 2012-07-10 10:22 pm
    • 2012-07-10 11:27 pm
  3. 2012-07-10 6:47 pm
    • 2012-07-10 9:25 pm
    • 2012-07-10 11:17 pm
    • 2012-07-10 11:54 pm
    • 2012-07-11 2:21 am
      • 2012-07-11 10:27 am
  4. 2012-07-10 8:39 pm
  5. 2012-07-10 8:53 pm
  6. 2012-07-11 12:12 am
  7. 2012-07-11 11:50 am
    • 2012-07-13 11:59 pm
      • 2012-07-17 11:33 pm
  8. 2012-07-15 8:54 am