How To Increase Heap Size in Eclipse?

SHARE & COMMENT :

If you get the error java.lang.OutOfMemoryError: Java heap space while running Java applications, it means that your Java application environment don’t have the sufficient space to store the values needed for your application. This could be because of the following reasons:

  • By mistake, you have set the less memory for your Java environment (or)
  • Your epplication is huge and allocated memory is not enough for your application’s size

In the either case, increasing the size of the memory is the solution. You can update the VM arguments as below to fix this issue. You have to select the application and update the required value as -Xms512M -Xmx1024M. This would resolve the problem while that application is running.

eclipse-heap-size

By default, eclipse.ini file under the Eclipse folder has the default configuration for the heap size. Note that it is used only for the Eclipse IDE. When you build your project using ANt / Maven tools, the external JVM is used and the values used in the eclipse.ini will not be used. If you update the values also will not resolve the problem. The sample eclipse.ini file looks like this. launcher.XXMaxPermSize parameter has to be increased for the heap size for your eclipse environment.

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better