JDK 6 update 21 kind of breaks Eclipse on Windows

If you recently upgraded to JDK 6 update 21 on Windows and are noticing lots of Eclipse problems, I probably know why (and can show you how to fix it).

First, some background. The HotSpot VM (Sun’s implementation) has a concept known as the Permanent Generation, or PermGen for short. Its main purpose is to confound users and it is rumored to be going away in future releases of HotSpot. By default, the VM allocates 64 MB for the PermGen space, which is often enough. However, Eclipse installations with a lot of plugins tend to need a lot more.

Because Eclipse is meant to work on multiple JVMs, the stock eclipse.ini doesn’t directly set the PermGen size, it has a line that looks like this:

–launcher.XXMaxPermSize
256m

That will tell the Eclipse launcher to set the perm size, if it is running on the HotSpot VM. Unfortunately, it appears this quit working with update 21 – a quick check with VisualVM showed that this flag wasn’t working and no matter what you set it to, your VM would have only 64MB of PermGen space.

It appears that the cause of this is that with update 21, the vendor flag was changed to Oracle, which broke Eclipse’s VM detection code. Thus, the flag is never being passed through to the VM. It appears as though this only happens on Windows and only when running the Sun (sorry, I’ll never call it Oracle) JVM.

Fortunately, it is easy to fix. Simply add this flag to the -vmargs section of your eclipse.ini (it should be at or near the bottom):

-XX:MaxPermSize=256M

That will directly set the PermGen size and should fix any PermGen errors you were running into.

Who knows what else changing the vendor flag broke?

  1. Eclipse unusable... - Android Forums - pingback on July 27, 2010 at 2:39 pm
  2. java.lang.OutOfMemoryError: PermGen space — Eatrocks - pingback on August 3, 2010 at 7:41 pm
  3. Awesome! Thank you so much, you just saved me from quitting Android development on Eclipse platform.

  4. As Saith said, I was also about to quit Eclipse with Android… thanks for the tip.

  5. thanks

    “Sun (sorry, I’ll never call it Oracle) JVM.”
    i love this statement.
    $ cant buy anything.
    especially intellectual-substance.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="">

Trackbacks and Pingbacks: