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
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
Start Tomcat Serverand look for log in
- 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.
Would love to know what you think. Chime in and share it as a comment. Don’t forget to share this guide!
java -Xms512m -Xmx2048m HelloWorld