eclipse 出现内存不足的错误,为什么?
当我在“Eclipse”IDE 中创建一个新项目时。突然它显示一条警报消息“内存不足错误”。我无法确定原因。 如果有人知道原因请告诉我。
When i create a new project in "Eclipse" IDE.Suddenly it shows an alert message "Out of memory error".I cannot identify the reason.
If any one know the reason please tell me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
尝试使用以下参数启动 Eclipse:
或者根据您的要求调整这些参数
Try to start eclipse with follow paramenters:
Or justify these parameters for your requirements
如果您在 Mac OS X 上运行 Eclipse
右键单击
eclipse.app
图标单击
显示包内容
打开
eclipse.ini
文件更改以下参数
<前><代码>-Xms512m
-Xmx3000m(希望您的开发者盒子有 >4GB 内存)
添加以下参数
<前><代码>-XX:PermSize=256m
-XX:MaxPermSize=512m
If you are running Eclipse on Mac OS X then
Right click on
eclipse.app
iconClick on
Show Package Contents
Open
eclipse.ini
fileChange below parameters
Add below parameters
最明显的解释是你确实失忆了。在这种情况下,使用更大的堆启动 Eclipse 应该有助于
改变 256M,看看什么适合您。
如果您只有几个简单的项目,我不会期望看到这个问题。如果您正在使用其他插件,那么可以想象您需要的堆数量可能需要增加。
The most obvious explanation is that you are truly out of memory. In which case starting Eclipse with a bigger heap should help
varying the 256M to see what works for you.
I would not expect to see this problem if you have just a few simple projects. If you are using additional plugins then conceivably the amount of heap you need may need to be increased.
不确定是否与您的问题相关,但我刚刚在使用 OpenJDK 7 的 Swing 项目中遇到了类似的问题。
经过几次启动(
Run
按钮)和关闭('X'< /code> /
Alt+F4
) 我的应用程序,我在控制台中收到此错误:有时,我收到另一种错误:
然后,如果我尝试再次运行它,Java 崩溃了:
top
揭示了问题的原因(注意虚拟内存使用情况):这些都是我的应用程序的实例,尚未关闭。仍然不确定为什么每个实例分配这么多虚拟内存 - 可能有一些选择。 (顺便说一句,我有 3GiB 的物理内存)。
这是我的 main() 方法:
我在教程中看到了注释行,并专门将其禁用以查看会发生什么。发生的情况是它默认为
HIDE_ON_CLOSE
,它不会关闭和处置框架。将
setDefaultCloseOperation
设置为 EXIT_ON_CLOSE 是我的解决方案。不过,有兴趣看到更多知识渊博的人对此的意见。Not sure if relevant to your problem, but I just had a similar problem with a Swing project using OpenJDK 7.
After several cycles of starting (the
Run
button) and closing ('X'
/Alt+F4
) my application, I got this error in the console:And sometimes, I got another sort of error:
and then, if I tried to run it once more, Java crashed:
top
revealed the cause of the problem (notice virtual memory usage):These were all instances of my application, which had not been closed. Still not sure why so much virtual memory was allocated per instance - probably there's some option for that. (I have 3GiB of physical memory, by the way).
Here's my main() method:
I saw the commented line in a tutorial and specifically disabled it to see what would happen. What happened was that that it defaulted to
HIDE_ON_CLOSE
, which did not close and dispose of the frame.Setting
setDefaultCloseOperation
to EXIT_ON_CLOSE was the solution for me. Interested to see input from more knowledgeable people on this, though.简要说明如下:
之前
之后:
In Brief See below:
Before
After:
对于每个在没有修复它的情况下最终陷入底部的人(像我一样)...
每次我尝试保存特定文件时,我的 Eclipse 都会耗尽内存。
Eclipse 有一个错误,它无法处理方法类型和方法名称之间的注释格式,如下面给出的代码。解决方法是将评论向上或向下移动
For everyone (like me) who ends up at the bottom without fixing it...
My Eclipse ran out of memeory every time I tried to save a specific file.
Eclipse has a bug where it is unable to handle formatting a comment between a method type and a method name, like the code given below. The fix is to move the comment up or down
您必须使用
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
您可以从这里看到
You have to use
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
You can see from here