简体   繁体   English

Eclipse:Java堆空间,如何解决?

[英]Eclipse: Java heap space, How to fix it?

i have an error at eclipse for a long time and i searched in stackoverflow for a solution, i found two diffirent suggestions but i try it without success. 我在eclipse上出现了很长时间的错误,我在stackoverflow中搜索了一个解决方案,我发现了两个不同的建议,但我尝试都没有成功。

First try, was to change the eclipse.ini file with the following changes, 首先尝试通过以下更改来更改eclipse.ini文件,

Try allocating more heap space to eclipse. 尝试分配更多的堆空间以供日食使用。 Go to eclipse.ini file in the eclipse directory and change heap space parameter. 转到eclipse目录中的eclipse.ini文件并更改堆空间参数。

-XX:MaxPermSize=256m
-Xms128m
-Xmx512m

the second try is to start eclipse with a command like this : 第二种尝试是使用如下命令启动eclipse:

eclipse -vmargs -XX:PermSize=128M -XX:MaxPermSize=512M

Sometimes it is working but after few hours the problem is back and sometimes i cannot solve this so i am waiting one day and the problem is away and it is coming again after some days. 有时它可以正常工作,但几个小时后问题又回来了,有时我无法解决,所以我等了一天,问题消失了,几天后又来了。 How can i fix it, because i cannot work on my project. 我如何解决它,因为我无法进行我的项目。

I am on Fedora 20. 我在Fedora 20上。

The memory usage depends on what do you do in the Eclipse and which plugins you have installed, but according to my experience 512Mb is not enough for comfortable work. 内存使用情况取决于您在Eclipse中执行的操作以及已安装的插件,但是根据我的经验,512Mb不足以满足舒适的工作需求。 I use for Eclipse Luna 64bit (eclipse.ini): 我使用Eclipse Luna 64bit(eclipse.ini):

-Xms128m
-Xmx1200m

With these settings I can have Eclipse opened for a week with hundreds of source files opened without having OutOfMemoryError . 通过这些设置,我可以将Eclipse打开一周,并打开数百个源文件,而不会出现OutOfMemoryError

Note that PermSize/MaxPermSize option is obsolete since Java-8 (it does not actually change anything). 请注意,自Java-8起,PermSize / MaxPermSize选项已过时(它实际上并未更改任何内容)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM