Eclipes增加記憶體的2種方法

  • Post category:eclipse

你安裝好Eclipes之後,開始寫你的專案,但是,發現運作的時候卡卡,或是很慢,那有可能是記憶體不夠,更嚴重會直接告訴你 OutOfMemoryError,這時候就需要增加記憶體。不是叫你去買記憶體啊,是透過設定的方式來調整Eclipes記憶體的使用量。

執行時增加記憶體參數

第一個方法是在執行eclipse的時候下記體調整的參數,你要使用Windows中的命令提示字元,並且切換到eclipse.exe 所在的路徑位置,如下:

eclipse.exe -vmargs -Xms1024M -Xmx1095M -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+UseParallelGC

命令提示字元設定記憶體參數
命令提示字元設定記憶體參數命令提示字元設定記憶體參數

但是,這個方式比較麻煩,每一次都必須要輸入參數,但是,另一個方法就不需要每次輸入記憶體的參數了。

原文網址:https://www.javainsoft.com/eclipse/config-ini-memory/

設定Eclipse.ini

你可以在你安裝Eclipse的路徑下找到這個設定檔eclipse.ini。

你只需要用簡單的記事本軟體就可以進行編輯,如下:

圖上黃的部分就是你需要調整的數字了

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms1024m
-Xmx4096m