天天看点

Eclipse内存溢出问题

今天在做Ext的项目时出现了一个问题,An internal error occurred during: "Workbench early startup".

GC overhead limit exceeded,从提示来看是内存溢出问题,GC overhead,看到这个,从以前开发角度想可能是eclipse配置的问题,首先找到了eclipse.ini文件,我的配置如下:

-startup

plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416

-product

org.eclipse.epp.package.jee.product

--launcher.defaultAction

openFile

--launcher.XXMaxPermSize

256M

-showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

256m

--launcher.defaultAction

openFile

--launcher.appendVmargs

-vmargs

-Dosgi.requiredJavaVersion=1.6

-Xms40m

-Xmx512m

优化之后的ini文件:

-startup

plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416

-product

org.eclipse.epp.package.jee.product

--launcher.defaultAction

openFile

--launcher.XXMaxPermSize

512M

-showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

512m

--launcher.defaultAction

openFile

--launcher.appendVmargs

-vmargs

-Dosgi.requiredJavaVersion=1.6

-Xms80m

-Xmx1024m

分别扩大了2倍,意外的收获是速度更快了,不过虽然eclipse比之前快了,但是想想觉得有问题了,毕竟计算机内存有限,给eclipse分配的多了其他的就少了,幸亏我的安装内存是16G,也就不在乎了。

从网上搜了一下关于配置的说明,

 其实这样做无异于杀鸡取卵,有得有失,不过在做ext的项目时多数会出现这样的问题,内存小的用户按照上边配置修改的话会出现这样的错误:An internal error occurred during: "Building workspace".

Java heap space;所以最好的办法就是把ext和项目分开放,ext作为moudle项目跟随主项目,部署的时候一起部署到服务器,

另外,从网上搜了一下解决办法,

方法一:把extjs4的工程安装包不要放到web工程中就ok或者建议直接用myeclipse直接导入的exjts4包,就没问题。

方法二:导入ExtJS包,这样会卡死eclipse的。去到工程根目录下,找到.project,用记事本打开,把两处删除掉:

第一处:

<buildCommand>

         <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>

         <arguments>

         </arguments>

</buildCommand>

第二处:

<nature>org.eclipse.wst.jsdt.core.jsNature</nature>

保存退出,refresh一下工程。再把ext包复制进工程

本人亲身试过第二种方法,可行。

继续阅读