1

I installed the emulator Pixel 2 API 33 on my Android Studio. Initially it consumed about 8GB of my disk space, but it now emerges to 10GB. I reckon it will grow larger in the future.

Why does that happen? Is there any way I can take back some memory or prevent this from happening again in the future?

Thanks!

6
  • @Robert It's disk memory. When remove the emulator and reinstall the latest image (aka. tiramisu one), it now costs only 513MB Commented Jan 5, 2023 at 9:55
  • Emulator disk images often only store sectors of the disk that are used. Over time different sectors are used so the mage grows. Some emulator can reclaim and reuse sectors that were used but the got free by deleting files inside the emulator. You should monitor the partition usage of the emulator images, e.g. in adb shell execute df -h to see the different partitions and how much space they have free/used.
    – Robert
    Commented Jan 5, 2023 at 9:59
  • @Robert Does that mean every time I install a new program on my emulator the disk occupation increases? And if so then when I update (aka, installing a newer version of the app on the VM, does it duplicately occupy my disk?) Commented Jan 5, 2023 at 10:13
  • If you use more disk space in emulator the image grows. Usually emulators are implemented that way that an image can grow at any time (up to the maximum virtual size it had been created with) but never shrinks. Not sure about Android Emulator/qemu.
    – Robert
    Commented Jan 5, 2023 at 10:16
  • You can use a workaround which would freeze the space usage to a given limit, but it would come at the cost of performance and a possible crash/freezing of the emulator when it finds no further space to use. Here's one approach. Create a file and allocate X GBs to it. Mount that file as a loopback (Linux specific) device, format it with a filesystem compatible with your OS, than move all the emulator AVD files into it. Fix references in the shortcuts to this new path, or mount it at the location where those files are expected. Done.
    – Firelord
    Commented Jan 5, 2023 at 18:14

0

You must log in to answer this question.

Browse other questions tagged .