Eclipse 堆空间(内存不足错误)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11266077/
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-09-10 21:08:50  来源:igfitidea点击:

Eclipse heap space (out of memory error)

eclipse

提问by user1491687

I am facing memory issue in eclipse. Initially I was getting this error: ‘Unhandled event loop exception java heap space' and also sometimes ‘An out of memory error has occured'.

我在 eclipse 中面临内存问题。最初我收到此错误:“未处理的事件循环异常 java 堆空间”,有时还会出现“发生内存不足错误”。

I somehow managed to increase my heap size upto -Xmx990m. But still its not working. When I try to increase heap size beyond that, I am getting error ‘Unable to create virtual machine' while starting eclipse.

我以某种方式设法将我的堆大小增加到 -Xmx990m。但它仍然不起作用。当我尝试增加堆大小时,我在启动 eclipse 时收到错误“无法创建虚拟机”。

I tried to make other changes in eclipse.ini file. When I change XXMaxPermSize, it gives me ‘permGen memory error'. For few times, I got different other kind of errors like ‘Unhandled event loop exception GC overhead limit exceeded' and 2-3 more different types. Please help me what can be done that would be great!

我试图在 eclipse.ini 文件中进行其他更改。当我更改 XXMaxPermSize 时,它​​会给我“permGen 内存错误”。有几次,我遇到了不同的其他类型的错误,例如“超出了未处理的事件循环异常 GC 开销限制”和 2-3 种不同类型的错误。请帮助我可以做些什么会很棒!

回答by machineghost

Jeshurun's somewhat flippant comment about buying more RAM is actually fairly accurate. Eclipse is a memory HOG! On my machine right now Eclipse is using 2.1GB; no joke. If you want to be able to use Eclipse really effectively, with all the great features, you really need lots of memory.

Jeshurun 关于购买更多 RAM 的有些轻率的评论实际上相当准确。Eclipse 是一个内存猪!现在在我的机器上 Eclipse 使用的是 2.1GB;不是开玩笑。如果您希望能够真正有效地使用 Eclipse,并拥有所有出色的功能,那么您确实需要大量内存。

That being said, there are ways to use Eclipse with less memory. The biggest helper I've found is disabling ALL validators (check "Suspend all validators" under Window>Preferences>Validation; just disabling the individual ones doesn't help enough). Another common source of memory-suckage is plugins. If you're going to stay at your current memory limit, I strongly recommend that you:

话虽如此,有一些方法可以使用更少的内存来使用 Eclipse。我发现的最大帮手是禁用所有验证器(选中“窗口”>“首选项”>“验证”下的“暂停所有验证器”;仅禁用单个验证器还不够)。另一个常见的内存占用来源是插件。如果您要保持当前的内存限制,我强烈建议您:

  1. Uninstall your current Eclipse
  2. Download the core/standalone/just Java version of Eclipse (the one with least filesize/no plug-ins built-in)
  3. Try using just that for awhile, and see how the performance is. If it's ok, try installing the plug-ins you like, one at a time. Never install multiple, and give each one a week or two of trial.
  4. You'll likely find that some plug-ins dramatically increase memory usage; don't use those (or if you do, get more RAM).
  1. 卸载当前的 Eclipse
  2. 下载 Eclipse 的核心/独立/纯 Java 版本(文件大小最小/无内置插件的版本)
  3. 尝试使用一段时间,看看性能如何。如果没问题,请尝试安装您喜欢的插件,一次一个。永远不要安装多个,每个都试用一到两周。
  4. 您可能会发现某些插件会显着增加内存使用量;不要使用那些(或者如果你使用,获得更多的内存)。

Hope that helps.

希望有帮助。

回答by PSR

I also faced the same problem.I resolved by doing the build by following steps as.

我也遇到了同样的问题。我通过按照以下步骤进行构建来解决。

-->Right click on the project select RunAs ->Run configurations

-->在项目上右击选择RunAs->Run配置

Select your project as BaseDirectory. In place of goals give eclipse:eclipse install

选择您的项目作为 BaseDirectory。代替目标给 eclipse:eclipse install

-->In the second tab give -Xmx1024mas VM arguments.

-->在第二个选项卡中,将-Xmx1024m作为 VM 参数。

回答by vish0910

I faced similar situation. My program had to run simulation for 10000 trials. I tried -Xmx1024m : still it crashed.

我遇到了类似的情况。我的程序必须运行 10000 次试验的模拟。我试过 -Xmx1024m :它仍然崩溃。

Then I realized given my program had too much to put up on console; my console-display memory may be going OOB.

然后我意识到我的程序有太多东西不能放在控制台上;我的控制台显示内存可能会 OOB。

Simple solution=> right-click console > preferences > Check Limit console output > Enter Buffer size(characters)[Default: 80000].

简单的解决方案=>右键单击控制台>首选项>检查限制控制台输出>输入缓冲区大小(字符)[默认值:80000]。

I had unchecked it for analyzing single run, but when the final run had 10000 trials, it started to crash passed 500 trials.

我没有选中它来分析单次运行,但是当最后一次运行有 10000 次试验时,它开始崩溃通过 500 次试验。

Today was the day: I thought three times, that how programming in Java helps me skip the whole job memory deallocation and cursed C for the same. And here I am, spent last 2 1/2 hours to find how to force GC, how to dellocate variable( By the way, none was required).

今天是这样的一天:我想了三遍,Java 编程如何帮助我跳过整个作业内存释放,并因此诅咒 C。我在这里,花了最后 2 1/2 小时来寻找如何强制 GC,如何释放变量(顺便说一句,不需要)。

Have a good day!

祝你有美好的一天!