I've been using Eclipse PDT for a while now. It's very easy to connect my IDE to my Drupal site. And it's very easy because I can easily access my Java projects too :-).
But I was running into some performance issues: Eclipse seems to be veryyyyy slow, and very unstable. I had to restart it every 2 hours. At DrupalCON, I also noticed some people were having troubles with Eclipse and performance. So I hope this blogpost will help a lot of people.
First of all, this blogpost is created based on a Ubuntu Lucid 10.04 operating system. I'm not using open-jdk, but I'm using the real implementation of Sun (well, Oracle :p)
<a href="mailto:jochen@DESKTOP">jochen@DESKTOP</a>-JOCHEN ~ $ dpkg -l | grep sun ii splix 2.0.0-2ubuntu3 Driver for Samsung's SPL2 (bw) and SPLc (col ii sun-java6-bin 6.20dlj-1ubuntu3 Sun Java(TM) Runtime Environment (JRE) 6 (ar ii sun-java6-jdk 6.20dlj-1ubuntu3 Sun Java(TM) Development Kit (JDK) 6 ii sun-java6-jre 6.20dlj-1ubuntu3 Sun Java(TM) Runtime Environment (JRE) 6 (ar
To be sure you are using the Sun implementation (or you want to see a list of JDK's on your machine), you can run the following command:
<a href="mailto:jochen@DESKTOP">jochen@DESKTOP</a>-JOCHEN ~ $ sudo update-java-alternatives -l java-6-sun 63 /usr/lib/jvm/java-6-sun
Anywayz, the important things is to create the following file: /usr/lib/eclipse/eclipse.ini
This is the contents for that file:
-vmargs -Xms128M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=512M
- vmargs: param indicating I want to specify "virtual machine" arguments
- Xms: initial Java heap size
- Xmx: maximum Java heap size
- XX:PermSize: the section of the heap reserved for the permanent generation holds all of the reflective data for the JVM. This size should be increased to optimize the performance of applications that dynamically load and unload a lot of classe
- XX:MaxPermSize: maximum size of the Permanent Generation
Now, it's very important to create each argument on a new line. Don't do this:
-vmargs -Xms128M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=512M
... don't ask me why this doesn't work, I think this is a bug in Eclipse ? ...
Now, to end this blogpost, we need to be sure this configuration is ok!? Right?
Fire up Eclipse and go to Window > Preferences. Pick General and check Show heap status

Now, to check if your settings were picked up by Eclipse, check the bottom right of your screen. You should something like this:

This will show you the heap size, as also a possibility to run the garbage collector (force it) by clicking the trash icon
Comments
I encountered this so much already.
The very first thing that should be done after any install of any Java IDE is to increase the permsizes. That fixes allmost all the issues immediatly. Not only for Eclipse but also IntelliJ, ...
Thanks for this very useful posting. On Mac OS X Mountain Lion with Apple's Java SE 6 distro this works for me:
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
1024M
--launcher.defaultAction
openFile
-vmargs
-Xms128M
-Xmx1024M
-XX:PermSize=128M
-XX:MaxPermSize=1024M
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
The .ini file is found in the directory: Applications >> eclipse >> Eclipse (show package contents) >> Contents >> MacOS
Add new comment