It’s common to get OutOfMemory while running heavy loaded application in Eclipse IDE. Recently while running Apache Tomcat under Eclipse for one of the web application I was getting Java
Heap memory related error
What needs to be done here basically is to increase the jvm heap size. So for increasing the JVM Heap Size of Tomcat in Eclipse we have to set few VM arguments of the tomcat.
Follow these simple steps to change the Heap Size of Tomcat under Eclipse. If you have below questions then you are at right place.
- Eclipse + Tomcat – java.lang.OutOfMemoryError
- How to increase tomcat memory inside eclipse
- Increase JVM max heap size for Eclipse
- java.lang.OutOfMemoryError: PermGen space in tomcat
- Configuration of the Eclipse Workspace
- How to set vm arguments in tomcat 8
Let’s get started
- Open Eclipse IDE
- Go to Server Tab
- Add Apache Tomcat Servers to Eclipse IDE with detailed steps
- Double Click on Tomcat Server
Click on “Open launch configuration” link.
- Go to
ArgumentsTab and Add below parameter as per your need.
- Click Apply and OK
Or you could apply
Start Tomcat Serverand look for log in Console Output
- You should see tomcat server started with mentioned parameters
Following are few options available to change Heap Size.
-Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size
In addition, you could set minimum heap to
512MB and maximum heap
2048MB for any Java program let’s say sample – HelloWorld.
java -Xms512m -Xmx2048m HelloWorld