Android Studio memory usage Ubuntu 16

被刻印的时光 ゝ 提交于 2019-12-10 18:17:59

问题


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


回答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



来源:https://stackoverflow.com/questions/45226992/android-studio-memory-usage-ubuntu-16

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!