Reduce Java Heap Memory
I Wrongly Increased the Heap Size of My Android Studio, and When I Start Android Studio, I Am Getting This Error Invalid Maximum Heap Size: -Xmx4096M #
I wrongly increased the heap size of my android studio, and when i start android studio , i am getting this error
Invalid maximum heap size: -Xmx4096m # <------ increase this to most of your RAM
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I know this is something related to Java heap memory, i have reinstalled the Android studio, but getting the same error.
Please tell me where can i change the heap size of Java ?? i am using ubuntu18
1 Answer
The start script <install-path>/android-studio/bin/studio.sh does consult the files as follows to read configurations.
For 64bit systems:
<install-path>/android-studio/bin/studio64.vmoptions
${HOME}/.AndroidStudio<version>/config/studio64.vmoptions
<install-path>/android-studio.vmoptions
For 32bit systems:
<install-path>/android-studio/bin/studio.vmoptions
${HOME}/.AndroidStudio<version>/config/studio.vmoptions
<install-path>/android-studio.vmoptions
Depending on your architecture 32bit vs 64bit and how you did change the heap size setting, you can look through the files mentioned above and alter the Xmx with a text editor of your choice.