Solution :
1. Solution – VM arguments
On Eclipse menu, clicks
Run -> Run Configurations.., select the Java application you want to run, clicks on theArguments tab, update the VM arguments with the following options
Bash
-Xms<size> - Set initial Java heap size
-Xmx<size> - Set maximum Java heap size
For example, -Xms512M -Xmx1024M
2. Mistake – eclipse.ini
The memory settings in
eclipse.ini is allocated to Eclipse IDE only, not the program you want to run. A very common mistake is updated the heap size in eclipse.ini, and expects it to solve above out of memory problem.
Note
The Java application, Ant / Maven build scripts, or unit test cases, are run as an external tool from Eclipse, and it does not inherit the VM settings in eclipse.ini.
The Java application, Ant / Maven build scripts, or unit test cases, are run as an external tool from Eclipse, and it does not inherit the VM settings in eclipse.ini.
But, if your Eclipse IDE is always crashed by no reason, you can try to increase the heap size and perm gen in
eclipse.ini.
/Users/mkyong/Downloads/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
Bash
-startu
openFile
-showsplash
//...
-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m
//...
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
P.S eclipse.ini is located in the Eclipse installation folder.
Ref : http://www.mkyong.com/eclipse/eclipse-java-lang-outofmemoryerror-java-heap-space/
沒有留言:
張貼留言