Android studio using > 100% CPU at all times - no background processes appear to be running
Thanks to Buzzrick (answered on this page, probably above my answer), he mentioned about VCS. Turning off all of the background operations of VCS seemed to have a HUGE impact toward the high cpu usage - it was 150% and now it's 20%, more or less.
I'm on OS X
Go to: Preferences > Version Control > Background. Now listed under 'Background Operations' are 6 options. I disabled the first three options which are:
Perform update on VCS in background, Perform commit to VCS in background, Perform checkout to VCS in background.
You can try the following options in the File Menu:
- File Menu -> Invalidate Caches / Restart... -> Invalidate and Restart
- Enable Power Save Mode by clicking on File -> Power Save Mode
Power Save mode only disable code insights and background tasks.
You might consider going to File > Invalidate Caches / Restart Your cache might be kicking off something funky in the background
I encountered a constant high cpu usage with no apparent reason. Invalidating cache did not work nor did the power save mode.
In my case there was a something wrong in the '.git' directory which was causing android studio to fail in an endless loop. Checking out the repo again fixed the problem.
My advice is to check the android studio logs for any hints to what is causing it to falter. You could also start it from terminal and check the Stdout/Stderr output.
I switched on power save in Android Studio 1.0 it helped but this meant I opted out on so many features that Android Studio has to offer. Thus I sought to find a better solution, I happened to always have a dialog box pop up and ask me to increase my VM size. Apparently once I increased this, I am able to switch off power save and have my Android Studio work perfectly.
This is how to do so:
On Mac OS go to /Applications/Android\ Studio.app/Contents/bin/studio.vmoptions
(To open contents right click on Android Studio app > View contents)
You will find the following variables
-Xms128m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=200m
-XX:+UseCompressedOops
On Windows go to Environment Variables and find a System Variable called _JAVA_OPTIONS
Increase these figures accordingly.
- Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM).
- Xms specifies the initial memory allocation pool.
i.e Your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory.