How To Increase Heap Size in Eclipse?

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.


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.




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.