I've been using Android Studio for 3 months now and one of the apps I started on it has become fairly large. The memory usage indicated at the bottom right of the program says my allocated heap is maxed at 494M.
When I start to change the XML files my memory usage quickly reaches that cap and the IDE crashes with an Out Of Memory error like this.
I've tried to increase the heap size using this but so far there has been no effect.
I've looked at dozens of articles and other questions on how to increase the heap size but none of their answers are working. No matter what I do to the VMOPTIONS or the IDE settings the heap size never increases. I believe I am editting the correct file for the VMOPTIONS because if I purposely give it an invalid command Android Studio complains about it and doesn't start.
I'm using windows 7 - 64 bit and have 16GB RAM. Has anyone else had this problem with Android Studio? And were you able to fix it?
I looked at my Environment Variables and had a System Variable called
_JAVA_OPTIONS
with the value-Xms256m -Xmx512m
, after changing this to-Xms256m -Xmx1024m
the max heap size increased accordingly.First check how much memory allocated for your android studio to check that follow this steps :
then check the show memory indicator option like below image red highlighted part
In my case my RAM is 12Gb so i have allocated memory for android studio 6gb .To edit that follow this steps
Help->Edit custom VM options
In my case, i have set it 6gb because my pc ram is 12 GB. Its upto you how much memory you want to allocate to your android studio
On Windows 7, the configuration files at
[INSTALL-LOCATION]\bin
seem to be ignored. Per the following Google documentation, the file to be modified should be here:%USERPROFILE%\.AndroidStudio\studio[64].exe.vmoptions
http://tools.android.com/tech-docs/configuration
Odd that there is no such file upon a clean install of Android Studio 1.1 from the developer site. And they are in the old (ignored) location. Once I copy the file (
studio.exe.vmoptions
in my case) over and modify it, the change is respected.However, the fun doesn't stop there. There's an upper value for
-Xmx
which may be related to the amount of memory in your system. I just bumped my machine's memory from 4Gb to 16Gb, and assumed I could set-Xmx
to2048m
, but I found that if I set it to anything larger than1500m,
Android Studio would silently fail to launch with no indication at all as to why. I have more RAM on the way, so it will be interesting to see if I can increase the value at that point.I hope this additional information is helpful. While all of the above replies were undoubtedly true at one point (and may still be in some environments), I found that this was the only approach that increased the memory used by AS for me.
Go in the Gradle Scripts -> local.properties and paste this
, if you want to change it to 512. Hope it works !
Open studio.vmoptions and change JVM options
studio.vmoptions locates at /Applications/Android\ Studio.app/bin/studio.vmoptions (Mac OS). In my machine, it looks like
Change to
And restart Android Studio
See more Android Studio website