Eclipse + Tomcat java.lang.OutOfMemoryError: Java heap space

摘要: In Eclipse IDE, run a Java web application with Tomcat server plugin, but the console prompts

In Eclipse IDE, run a Java web application with Tomcat server plugin, but the console prompts

Exception in thread "x" 
	java.lang.OutOfMemoryError: Java heap space

1. Solution – Increase Heap Size in Tomcat

By default, Tomcat allocated a small amount of heap size. To solve it, you need to increase the Tomcat’s heap size manually.

1.1 In server view, double clicks on the Tomcat Server icon.

1.2 Clicks on the “Open launch configuration” link.

1.3 Clicks on the “Arguments” tab, and append the following VM options at the end of the VM arguments :

-Xms<size> - Set initial Java heap size
-Xmx<size> - Set maximum Java heap size

In this example, we increase the heap size to -Xms512m -Xmx1024m, it should be enough for most of the projects.

2. Know Your Heap Size

To know how much heap size is allocated in Tomcat, append this VM option -XX:+PrintFlagsFinal (refer figure 1.3). Start Tomcat, you will noticed the entire VM values are dump to the console, find following names :

  1. InitialHeapSize
  2. MaxHeapSize

P.S The value is in bytes.

References

  1. Java heap memory size

上一篇: jConsole JMX remote access on Tomcat
下一篇: Grep for Windows findstr example
 评论 ( What Do You Think )
名称
邮箱
网址
评论
验证
   
 

 


  • 微信公众号

  • 我的微信

站点声明:

1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱:summer@yihaomen.com, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号