Sunday, November 18, 2007

Workaround for Heap Space Problem in Eclipse

My earlier experience with Eclipse on Ubuntu can be found at

Getting Eclipse to Work on Ubuntu

Heap Space Problem:
I was wondering why configuring eclipse.ini file in /usr/lib/eclipse/eclipse.ini wasn't reflecting.

My eclipse.ini file ha the following content:

-------------------------------------------------------------
-vmargs
-Xms256m
-Xmx512m
-------------------------------------------------------------

But this didn't get reflected.
To check the heap status at all time do the following:
Goto Window -> Preference inside Eclipse.
In the general Section you will see a checkbox labeled Show heap status
Make sure this is checked. If this is checked you should be able to see bar in the bottom displaying the Heap Status. I saw that it always saw xxM of 62M SO my assignment of 256 M wasnt working.

Then I tried to set the Heap Space through terminal each time i run Eclipse then it worked.
Here is the command that I used.

eclipse -data /home/rungss/workspaces/eclipse-pdt -vmargs -Xms256M -Xmx512M

-data is the option to select the Workspace.
Now I have set new item in my Top Panel with the following details for each of my Workspaces.

To add a new Item to the Panel right click on the Panel click on Add to Panel from the popup menu.

You will see a popup window to select a Program to launch.
Select Custom Application Launcher which you should see at top left.

Now in the new popup window enter the following information
Type: Select Application from the drop down box (It will be selected by default)
Name: Enter the name for this Launch Configuration I have (Eclipse PDT)
Command: enter the command here in my case it is eclipse -data /home/rungss/workspaces/eclipse-pdt -vmargs -Xms256M -Xmx512M
Comments: Enter any Comment if you want to(It helps as You see both the Name and the Description on the tooltip for the Panel item.) I have set it to Eclipse PDT Workspace
Click on Close.

This works fine for me.

Now I dont see the Heap space Problem any more.

1 comment:

  1. While this is an older post, I would like to thank the author for writing this. I waas having problems with Eclipse, and Google brought up this post. Needless to say I have now solved my problem, and I give thanks to you!

    ReplyDelete