Java OutOfMemoryError:IntelliJ 内存不足?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28411803/
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
OutOfMemoryError: insufficient memory in IntelliJ?
提问by itro
When I run my project in IntelliJ in debug mode I get the following error.
当我以调试模式在 IntelliJ 中运行我的项目时,出现以下错误。
Does anybody know what is the cause?
有谁知道是什么原因?
I already increased my heap size in idea.vmoptions
:
我已经增加了我的堆大小idea.vmoptions
:
-ea
-server
-Xms1g
-Xmx3G
-Xss16m
-Xverify:none
-XX:PermSize=512m
-XX:MaxPermSize=1024m
I already increased my heap size for compiler to 1024 as bellow:
我已经将编译器的堆大小增加到 1024,如下所示:
采纳答案by Mike Nakis
You have tried:
您已经尝试过:
Increasing the heap size of the IntelliJ IDEA IDE, which has absolutely no effect on how much memory is available to your program at runtime, and
Increasing the heap size for the compiler, which alsohas absolutely no effect on how much memory is available to your program at runtime.
增加 IntelliJ IDEA IDE 的堆大小,这对您的程序在运行时可用的内存量完全没有影响,以及
增加编译器的堆大小,这也绝对不会影响程序在运行时可用的内存量。
Try Run
menu -> Edit Configurations...
-> find your project in the tree of projects on the left, look for VM options:
in the panel on the right, and enter something there, according to information found here: What are the Xms and Xmx parameters when starting JVMs?
尝试Run
菜单 -> Edit Configurations...
-> 在左侧的项目树中找到您的项目,在VM options:
右侧面板中查找,然后根据此处找到的信息在那里输入一些内容:启动 JVM 时 Xms 和 Xmx 参数是什么?
That having been said, I should also add that if you are running out of memory without knowingly doing extremely memory hungry stuff, then what you have in your hands is a bug which is causing your program to do runaway memory allocation, which will always be resulting in out-of-memory errors no matter how much you increase your heap size. In that case, you will need to look at your code, not at your project options.
话虽如此,我还应该补充一点,如果您在没有知情的情况下用尽了内存,而没有故意做非常消耗内存的事情,那么您手中的错误是导致您的程序进行失控的内存分配,这将始终是无论您增加多少堆大小,都会导致内存不足错误。在这种情况下,您将需要查看您的代码,而不是您的项目选项。
回答by itro
It is very strange still i don't understand why but I resolved it by decreasing the size of VM Options: -Xmx820m
.
Maybe because i use jre 32 bit en my Intellij IDE runs on 64 bit.
很奇怪,我仍然不明白为什么,但我通过减小VM Options: -Xmx820m
. 也许是因为我使用 jre 32 位,我的 Intellij IDE 在 64 位上运行。