Tuesday, March 30, 2010

Java Out of Heap Space In Eclipse Galileo Tomcat

If you get this error, it can be quite confusing where to increase the memory.

1) You can try and increase the memory in eclipse.ini file.
2) You can add -vmargs parameters when starting eclipse.
3) You can add -vmargs to your JVM when starting it.

I added the -vmargs to my eclipse.ini file and that didn't help. My application continued to get the Java Out of Heap Space error. I selected the properties on my eclipse shortcut and added the parameters there like so: C:\EclipseGalileo\eclipse\eclipse.exe -vmargs -Xms512M -Xmx512M. That actually increases eclipse heap space. You can check that by selecting windows->preferences->general and selecting show heap status. This will show you the heap space memory usage in the lower right hand corner of eclipse.

But, to prevent your application from running out of memory in Tomcat, you have to increase the parameters in your JVM. You can do that by selecting Windows->Preferences->Java->Installed JREs and select edit on your Installed JRE that you are using. I added -Xms512M -Xmx512M under the default VM arguments which solved my problem.

0 comments: