Friday 25 July 2008

OutOfMemory Error from eclipse

I know there are hundreds of blog entries covering this. Here is another.

I followed the general scriptures and set the values in my eclipse.ini file. Currently mine looks like this:

-showsplash
com.genuitec.myeclipse.product
--launcher.XXMaxPermSize 256m
-vmargs
-Xms128m
-Xmx1024m
-Duser.language=en
-XX:PermSize=128M
-Xss2m
-XX:MaxPermSize=256M

However I was still getting OutOfMemory errors when trying to run an ant test coverage task. Why ?

I solved the problem, or should I say I have not seen the problem since I did the following:

In eclipse go to:
Window->Preferences->Java->Installed JREs.

Select the JRE that you are using and select 'Edit'.

Then add the following to the 'Default VM Aguments'
-Xms128m -Xmx1024m -XX:MaxPermSize=256m

2 comments:

Andrew Beacock said...

The reason for this issue is that you have changed the amount of memory that Eclipse will use when running itself as an editor but it spawns off additional Java VMs for any scripts/tests/processes. That's why you had to change the installed VMs settings.

Andrew Beacock said...

How funny I've just run into an OutOfMemoryError when running some integration tests using Spring's application context.

Glad you posted this buddy!