Changing VM settings in IntelliJ IDEA : Error occurred during initialization of VM

17,896

Solution 1

There are two sides to this.

  • If you're using a 32-bit JVM and have 4GB or more memory, then you may be running into an issue with non-contiguous Java memory. The solution there would be to switch over to a 64-bit JVM.

  • If you're using a 64-bit JVM already, then increase the amount of memory you use when running your application. Here are some numbers:

    -Xms128m
    -Xmx512m
    -XX:MaxPermSize=300m
    -ea
    

Solution 2

There are two files in the Intellij installation directory idea.exe.vmoptions and idea64.exe.vmoptions. I was changing the wrong file for a while to increase the memory and could not get it to work. Open the appropriate file and increase the memory as mentioned in the previous answer to solve this problem.

Share:
17,896
Chillax
Author by

Chillax

Updated on June 05, 2022

Comments

  • Chillax
    Chillax almost 2 years

    Was trying to install a module using maven in IntelliJ IDEA. It threw the following error on doing so

    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] There are test failures.
    

    My questions are:

    1. Is this due to the VM size settings in idea/bin/vmoptions file? Will increasing it make any difference?
    2. If so, how do I do it? Since I don't have the necessary privileges to edit the file, is there an other option to change it from IntelliJ rather than editing the file?
    3. If not possible will it be really worth requesting for admin priv for changing it?

    Edit: Current vmoptions file contents (using Intellij IDEA 8.1.4 )

    -Xms32m
    -Xmx256m
    -XX:MaxPermSize=150m
    -ea