3

I'm facing an issue when consecutively running my android test class on an emulated device. I notice that after each run my PC RAM usage steadily increases by about 1.1Gb. This happens until my RAM is full, and then I have to restart my Android Studio and Emulator to run the test class smoothly again.

To investigate I looked at my system monitor. In it, my emulator and android studio maintain roughly constant RAM usage after each test class run.

android studio and emulator RAM usage

However my total RAM usage steadily increases after each test class run 3.2 -> 4.3 -> 5.5 -> 6.7 Gb

On my emulated device I see that my app's maximum memory usage has only been 30mb

I have tried clearing memory after each run using echo 3 > /proc/sys/vm/drop_caches and this did not affect RAM usage.

I am running Android Studio 2.2.3 on Ubuntu 16.04. The emulated device I use is Android 7.0 API 24 running on Nexus 5, 1Gb RAM, started in terminal using AVD. The test class I'm running contains UI tests using Espresso.

UPDATE: This happens even when running empty espresso tests on an activity with a blank screen (no views). Please find code here

Leroy Dunn
  • 361
  • 4
  • 7

1 Answers1

-1

Android Studio needs to use high CPU because of Gradle and it's heavy tools.

Android Emulator needs high CPU too.Use Genymotion instead it.

Your Ram's Minimun must be 8 to run Android Studio fast. If you have less RAM,It's too hard to work with Android Studio. I have just 2.7 RAM and I'm forced to use unsupported Eclipse ADT.

To decrease RAM usage:

1-Make Gradle Offline

2-Disable plugins you don't need

3-And Many ways Here:

Android Studio is slow (how to speed up)?

Android studio Gradle build speed up

https://medium.com/@haydar_ai/easy-ways-to-speed-up-android-studio-2fafe1179b43

Buzgush
  • 1
  • 3
  • 1
    I appreciate your feedback. However it does not address the issue of Android Studio's increasing memory usage after running test classes. – Leroy Dunn Jul 24 '17 at 22:41
  • https://stackoverflow.com/questions/45314878/android-studio-excessive-memory-usage-when-running-espresso-ui-tests – Leroy Dunn Jul 25 '17 at 23:13