Free Space on Android Internal Storage with a VM tweak
Free Space on Android Internal Storage with a VM tweak
 

Android has never been kind with low-end devices. With each new release, storage and hardware requirements are getting higher. This is more of an Operating System design drawback: It is well known that Android makes extensive use of the Java programming language in its internals and that almost all third-party Android Apps are written in Java. Java needs a Virtual Machine (VM) to run. The VM is responsible for interpreting the Java code into hardware-specific byte code, which is then executed on the device processor. When the workload is big, this procedure might be slow, even on devices with higher specifications.

To face this, Google developed its own VM which incorporated various optimizations for its OS. Android has been using the Dalvik VM up to Android KitKat. It featured Just-In-Time compilation, which saved an app’s byte code on the device storage (dalvik-cache) when it was executed for the first time. Since Android Lollipop, ART was introduced and officially replaced Dalvik.

ART enables Ahead-Of-Time complication (AOT), which actually compiles Apps into byte code before they are opened by the user and saves them to cache, in an effort to increase the system responsiveness and speed. All these optimizations though are not designed having budget devices in mind. They usually make use of big amounts of storage space and computational power.

Leaving the technical information aside, there is a way of disabling JIT and AOT and having Dalvik/ART interpreting Apps directly at the time they are being executed, without saving any byte code to the storage. This might actually keep the device processor busier, but most devices can easily handle the extra load. It can be done by editing the build.prop file on the System partition.

Notes:

  • Some manufacturers tend to ship custom Dalvik/ART VM run-time libraries with stock ROMs, where the VM will not take the following configuration parameters into consideration on boot and there will be no difference after applying them. If you are using a custom-built AOSP/CyanogenMod/LineageOS based ROM, most probably this procedure will work on your device.
  • Make a full backup of your device before applying these changes. There is a chance you get a boot-loop.

Prerequisites

  • Root Support. Needed for editing the build.prop file

Now describe the steps described below:

Don’t miss: 20 build.prop Tweaks to Customize Your Android in Awesome Ways

Step 1:

  • Open and edit your build.prop file. I will not get into details on how to do this since it is covered already on Droidviews here.
  • Add (or change if they are already available) the following lines in build.prop:
    dalvik.vm.dex2oat-filter=interpret-only
    dalvik.vm.image-dex2oat-filter=interpret-only
    dalvik.vm.usejit=false
  • Save the file

Step 2:

Clean Dalvik-cache/ART-cache. If you have a custom recovery installed, you can do this through the recovery UI. Otherwise, this can be done by opening a terminal app on Android and applying the following commands:

su
rm -rf /data/dalvik-cache

Step 3:

Reboot your device. If you see a message while booting informing about optimizing Apps, then most probably your VM does not support these properties.

If this procedure works on your device, you will get some extra free space on your Internal Storage. Its amount will depend on the number and size of installed apps.

Must read: 5 Must Have Root Apps in 2017

This site uses Akismet to reduce spam. Learn how your comment data is processed.