There are a lot of answers that are now outdated. The desired way of changing the heap size for Android Studio recently changed.
Users should now create their own vmoptions file in one of the following directories;
Windows:
%USERPROFILE%\.{FOLDER_NAME}\studio64.exe.vmoptions
Mac:
~/Library/Preferences/{FOLDER_NAME}/studio.vmoptions
Linux:
~/.{FOLDER_NAME}/studio.vmoptions and/or ~/.{FOLDER_NAME}/studio64.vmoptions
The contents of the newly created *.vmoptions
file should be:
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops
To increase the RAM allotment change -XmX750m
to another value.
Full instructions can be found here: http://tools.android.com/tech-docs/configuration