Workarounds for SSH deployment to tomcat memory overflow-outofmemoryerror

Source: Internet
Author: User
Tags xms

After deploying the project with SSH, the OutOfMemoryError PermGen space system error will appear after several deployments, and by checking the data online, it is not the problem of Tomcat, and the JVM design itself is a flaw, the JVM has divided the memory into different zones, The full name of PermGen space is permanent Generation space, which refers to the permanent storage area of memory, which is stored in this area when the class is loaded. Sun was designed to think the area was fixed when the JVM started, but he didn't expect it to be used so extensively. And this area has a special garbage recovery mechanism, now the problem is that the dynamic loading class to this area, the GC has no way to recycle!

I did not think that this problem has not been solved, some of the best solution is not to use the JDK, using BEA jrokit, of course, now Oracle,bea,su has become a family, I think this problem should be faster and better solutions.

Ok or talk about how to solve the problem, online a large number of data said in the Tomcat set: Set java_opts=-xms64m-xmx512m, but after my test, not a bit of a role, detailed look at the JVM memory allocation mechanism to know,- XMS and--xmx are resizing Java heap space (that is, heap memory), where objects are stored in the Ava Heap space area, and the GC collects this area.

If the exception type that appears is: Outofmemoryerror:java heap space, set java_opts=-xms64m-xmx512m.

If the exception type that appears is: OutOfMemoryError PermGen space, set java_opts=-xms128m-xmx512m-xx:permsize=128m-xx:maxpermsize= 256m

There are two common ways to set this up:

If you start Tomcat in the development environment, take eclipse as an example: select Window->preferences->myeclipse-servers-tomcat->jdk in the right-hand box optional Java VM Arguments add:-xms128m-xmx512m-xx:permsize=128m-xx:permsize=256m

If you start Tomcat independently, modify the Tomcat/bin/catalina.bat file to find the set java_opts, and then change the line to:

Set java_opts=-xms128m-xmx512m-xx:permsize=128m-xx:maxpermsize=256m, note:-xms+x:permsize cannot be larger than the maximum JVM size supported by the system. Size according to your own memory size adjustment bar.

Workarounds for SSH deployment to tomcat memory overflow-outofmemoryerror

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.