I noticed that especially working with several projects in my workspace, Eclipse got sluggish and slowly responding. I have in Eclipse the Heap Monitor/Status enabled (see “Show Heap Status in Eclipse“):
So the used heap of the Java VM is hitting a limit of about 500 MByte, and seems to be trashing around? How to increase that heap size?
Eclipse .ini File
The heap size is specified and set through an .ini file at Eclipse startup. That ini file is inside the ‘eclipse’ folder, e.g. ‘eclipse.ini’ for stock Eclipse, or ‘kinetis-design-studio.ini’ in the case of Freescale Kinetis Design Studio v3.0.0.
My original kinetis-design-studio.ini is the following:
-startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20150204-1316 -product com.somniumtech.branding.kds.ide -showSplash com.somniumtech.branding.kds --launcher.defaultAction openFile -name Kinetis Design Studio --launcher.XXMaxPermSize 256m -vm features/com.somniumtech.jre.win32.win32.x86_220.127.116.11/jre/bin -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms256m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512m
Options to specify the Heap Size
The interesting options are the ones after -vmargs which get passed to the Java Virtual Machine (VM):
- -Xms: initial start heap size
- -Xmx: maximum heap size
The -XX options are passed to the VM internally, and with newer VM’s they are ignored.
That -Xmx512m explains why my memory was limited to about 512 MByte. I was hitting that limit, and the Java VM memory manager was thrashing around slowing down performance. So I increased that value to
and performance dramatically improved :-). And now I see that my configuration need much more memory than it was available, explaining the Eclipse slowness:
💡 Depending on the amount of memory on your machine, you might go with a lower value than 1024. I have 8 GB Memory on my machine, and the value of 1024 worked fine.
Depending on the amount of projects in my workspace, and depending on which plugins I’m using, the default Eclipse Java VM size might not enough. Edit the .ini inside the eclipse folder and increase the value of the -Xmx parameter to a higher value, and you should see a performance improvement. I noticed especially for projects using Processor Expert a big improvement.
Happy Speeding 🙂
- Understanding Eclipse Java parameters: https://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
- Finding maxium Eclipse heap size: http://stackoverflow.com/questions/8836095/how-to-find-maximum-allowed-maxpermsize-for-eclipse
- Understanding memory parameters for Eclipse: http://stackoverflow.com/questions/12864732/understanding-memory-parameters-for-eclipse