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 # <------ 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

3

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like