Should the Dalvik cache on Android phones be cleared periodically?

Wrichik Basu

Insights Author
Gold Member
2018 Award
1,137
978
Finally, after a lot of hesitation, I rooted my phone (Samsung Galaxy On7, Android 6.0.1) using Magisk systemless root. The main aim was to remove pre-installed useless software (often termed "bloatware").

I didn't want to flash Magisk using TWRP, because installing TWRP would remove the stock recovery, and I would never get it back. I tried rooting using the Magisk installer itself, but it failed. So I had to unwillingly install TWRP first (thereby losing the stock recovery). I tried doing that using ADB (actually fastboot), but it couldn't recognise the device in bootloader mode. So I downloaded Odin and flashed TWRP. Then I flashed the Magisk zip file.

After the flashing was over, I also cleared the Dalvik cache, not knowing that this was not necessary. When I rebooted the phone, it took a long time to boot. It was showing, "Optimizing apps". I thought I had cracked the phone up and it was a boot loop. But later I found that everything was fine. In addition, clearing of the Dalvik cache actually freed up the internal memory by about 1GB.

I read online that Dalvik cache is actually the optimized dex files that the dex compiler builds to ensure the smooth running of applications. Now, the last official update to this phone was back in April 2018. Is it possible that the phone retained the cache of all apps since then, including the ones I had uninstalled? It seems so, otherwise how could I recover about 1GB of memory simply by clearing the Dalvik cache?

If I am correct that clearing the Dalvik cache freed up space, does it make sense to clear the Dalvik cache periodically, say annually, so as to prevent misuse of the "precious" internal memory?
 

anorlunda

Mentor
Insights Author
Gold Member
7,554
4,265
Wow! What a lot of work and trouble. I know that bloatware is annoying, but was it worth that much to get rid of it?
 

Wrichik Basu

Insights Author
Gold Member
2018 Award
1,137
978
Wow! What a lot of work and trouble. I know that bloatware is annoying, but was it worth that much to get rid of it?
Actually, my phone was getting too slow to work with. I never had any games installed (except maybe when the phone was first bought, but that is a long time back). I specifically installed the apps which could be moved to SD card. Even then, every morning, I would see more and more of internal storage being used up. This became irritating. If I took the phone to a service centre, they would either do a factory reset or ask me to change the motherboard. The second one is quite costly.

I read online that if you root the phone, then you can remove these system apps easily. Although your reserved system space is still not available for user app installations, the phone still becomes a bit faster, at least people on StackOverflow commented so. (You can actually use the freed-up system reserved space if you want, using the Magisk module "App Systemizer". It converts user-installed apps to system apps, and those will stay even if you unroot your device). Basically, this was the motivation. In addition, I was always interested in stuff like these, so it was not much trouble, except that I was scared that I might brick the phone. Also, XDA Developers have published extensive guides to root a phone, and they are very helpful for beginners like me.
 

Wrichik Basu

Insights Author
Gold Member
2018 Award
1,137
978
Update: The phone suddenly switched itself off, and is now in a bootloop.:cry::headbang:
 

Wrichik Basu

Insights Author
Gold Member
2018 Award
1,137
978
Update #2: Amidst the tension of losing the phone, it came to my mind that if I can somehow get the stock ROM and flash it, the phone will come back. So I started searching the net frantically, and finally came across the stock ROM. Downloaded it (a 1GB file), flashed it with Odin (the phone was able to enter recovery and download mode).

And finally, I have my phone back! Phew!
 

Tom.G

Science Advisor
2,773
1,561
General rule with computers:
Make a backup FIRST!
 

Wrichik Basu

Insights Author
Gold Member
2018 Award
1,137
978
General rule with computers:
Make a backup FIRST!
I store all my data in SD Card, so I didn't lose any personal data. What I lost was a couple of screenshots in the phone memory. My contacts are in Google account, so no fear losing them.

What I should have backed up was the stock ROM. The version of stock ROM that I found online was an old one, and I had to download all the OTA updates. As soon as all the updates were downloaded, I installed TWRP and backed up the system and app data. It is a ~5GB file, and I shall keep it safely for the future.
 

Want to reply to this thread?

"Should the Dalvik cache on Android phones be cleared periodically?" You must log in or register to reply here.

Related Threads for: Should the Dalvik cache on Android phones be cleared periodically?

  • Posted
Replies
10
Views
661
  • Posted
Replies
2
Views
2K
  • Posted
Replies
2
Views
4K
  • Posted
Replies
0
Views
2K
Replies
13
Views
3K
  • Posted
Replies
9
Views
4K
  • Posted
Replies
12
Views
3K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top