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包複製進工程
本人親身試過第二種方法,可行。