4

After upgrading Android Studio to 2.3, I've encountered extremely high memory usage. Previously, I would keep my pc(including Android studio and emulator) on for several weeks, and RAM usage would stay below 12GB. However, after upgrading to 2.3, it takes about 6 hours of work until system runs out of RAM and starts using swap memory, furthermore, after full day of work, almost all swap memory is used up too.

First image is screenshot of System Monitor after reboot: After Reboot

Second Screenshot is after single build: After single build

free -mh

              total        used        free      shared  buff/cache   available
Mem:            15G        5,6G        6,2G        1,1G        3,7G        8,5G
Swap:           15G          0B         15G

My System: i5-6500, Ubuntu 16.10, 16GB DDR4, 16GB swap.

Is there anything else that would help? Some config files, etc.?

I will add more information later, when system starts using swap memory.

EDIT:

Idea config:

# custom IntelliJ IDEA VM options

-Xms512m
-Xmx8g
-XX:ReservedCodeCacheSize=480m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Dawt.useSystemAAFontSettings=lcd

Gradle properties:

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx8192M

Tomorrow, I will try change xmx from 8gb to 4gb and see if it improves performance.

After several hours of work: After several hours

              total        used        free      shared  buff/cache   available
Mem:            15G         12G        230M        2,1G        3,0G        829M
Swap:           15G        2,0G         13G

As you can see, there's a third java instance running, and I looked what that is - and it's Kotlin daemon. So, in total I get 3 java instances: Kotlin, Gradle daemons and Android Studio itself.

It's seems that something has changed regarding the build caching.

  • Android Studio is based on JetBrains Idea platform and they have a config file that should allow you to limit a RAM usage. Try to find the config and edit it. UPDATE: also you can try to strace the pid of Android Studio - it should give you some insight on what process tries to do. Run sudo strace <pid>. – ddnomad Mar 15 '17 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.