Tuesday, November 20, 2007

Eclipse Europa (3.3) OutOfMemoryError: PermGen space

I like new Eclipse Europa (v.3.3). It has many advatages. It's faster and better and more... My colleague posted good review (Polish only) some time ago so I won't repeat. But there is one stinky thing about Eclipse when one try to work with bigger project... Eclipse Europa suddenly crashes without any error message. The cause: OutOfMemoryError. This damn thing kills all invention as you have to restart Eclipse to continue work. But even with that trick in a pocket one won't go far because it will happen soon again.

How to check whether it is memory error? Find workspace\.metadata directory and open .log file. Then jump to the end and look for stack trace with OutOfMemoryError: PermGen space. That's the cause.

I found many gurus who had very good ideas and theories about memory options that should be passed to greedy Eclipse but not many of them made any impression on Eclipse's memory hunger. So forget about eclipse.ini and it's content. Just modify your shortcut and set something about that

"C:\Program Files\eclipse3.3\eclipse.exe" -vmargs -Xms256m -Xmx952m -XX:MaxPermSize=256m

I run 2GB box at my work. As for weird 952 Megs for maximum memory size. It was chosen throught set of experiments. I found that there's a connection between each argument. If you change Xms param suddenly Xmx becomes invalid (and crashes Eclipse during startup). So do some experiments too with your start params.

My experience is that Eclipse 3.3 never goes beyond 500 Megs of physical memory and 500 Megs of virtual so maybe almost 1 Gig is too much but I never saw OutOfMemoryError again.

7 comments:

  1. Well, I had the same problem sometime back and I added only -XX:MaxPermSize=256m and it works ok for me. Nice post. This is a major issue in Europa bundle which is not talked about much.

    ReplyDelete
  2. Please Say me the exact Answer for this issue. Where i have to add this "XX:MaxPermSize=256m" Since i am facing this Problem often in my Eclipse Europa while running my application

    ReplyDelete
  3. I will just qoute my article:

    Just modify your shortcut and set something about that
    C:\Program Files\eclipse3.3\eclipse.exe” -vmargs -Xms256m -Xmx952m -XX:MaxPermSize=256m

    So you have to modify your shortcut to Eclipse...

    ReplyDelete
  4. i hav been having dis permgen space problem in eclipse for the past 3 days...and how do i modify the shortcut?? i don get u....can u be more clear or atleast help me out wit the steps as of how to proceed...

    ReplyDelete
  5. Deeptha,
    I assume you have MS Windows. You have to create a link to eclipse.exe file. Put it in convenient place then edit it (right click end edit) and in line pointing to eclipse.exe add -vmargs -Xms... parameters. Is this enough explanation for you?

    ReplyDelete
  6. Great post! I’ve trapped in this damn issue for a week, and I even have switched to NetBeans!!
    Your solution works well for me, great thanks!

    ReplyDelete
  7. @cartman, I'm glad to help you. Best regards.

    ReplyDelete