java 在 IntelliJ IDEA 中更改 VM 设置:VM 初始化期间发生错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13220048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 11:55:20  来源:igfitidea点击:

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

javamavenintellij-ideajvmsize

提问by Chillax

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

试图在 IntelliJ IDEA 中使用 maven 安装模块。它在这样做时引发了以下错误

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?
  1. 这是由于idea/bin/vmoptions文件中的VM大小设置吗?增加它会有什么不同吗?
  2. 如果是这样,我该怎么做?由于我没有编辑文件的必要权限,是否还有其他选项可以从 IntelliJ 更改它而不是编辑文件?
  3. 如果不可能,是否真的值得要求 admin priv 进行更改?

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

编辑:当前 vmoptions 文件内容(使用Intellij IDEA 8.1.4

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

回答by Makoto

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
    
  • 如果您使用的是 32 位 JVM 并且有 4GB 或更多内存,那么您可能会遇到非连续 Java 内存的问题。解决方案是切换到 64 位 JVM。

  • 如果您已经在使用 64 位 JVM,请增加运行应用程序时使用的内存量。以下是一些数字:

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

回答by An Illusion

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.

Intellij安装目录idea.exe.vmoptions和idea64.exe.vmoptions有两个文件。我有一段时间更改了错误的文件以增加内存,但无法使其工作。打开相应的文件,按照上一个回答中提到的方法增加内存来解决这个问题。