Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Improve Eclipse Performance with Increased Heap Size

DZone's Guide to

Improve Eclipse Performance with Increased Heap Size

Learn all about optimizing your Eclipse performance with an increased heap size.

· Performance Zone
Free Resource

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

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“):

Heap Status at the Limit

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_1.7.0.76/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

-Xmx1024m

and performance dramatically improved :-). And now I see that my configuration need much more memory than it was available, explaining the Eclipse slowness:

Heap Status

Heap Status


:idea: 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.

Summary

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.

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

Topics:
performance ,eclipse ,heap size

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}