Troubleshoot a memory overflow problem with Tomcat

Source: Internet
Author: User
Tags tomcat server

Tomcat server appears Java.lang.OutOfMemoryError:Java heap space exception

1, may be a program error, such as: The program into a dead loop

2, heap memory is too small
In general, Java-created objects are collected by GC after they are not used for a period of time
If the amount of data processed at the same time is large: such as larger query results or open large files, there may be a heap of memory problems
JVM default heap memory is 64M, changing the default heap size by configuration
Set java_opts=%java_opts%-xms512m-xmx1024m

3, after running for some time, may appear java.lang.OutOfMemoryError:PermGen space anomaly
All new objects generated by the JVM are placed in the new domain. Once the object has experienced a certain amount of garbage collection loops, it gets the usage period and goes into the old domain.
In a permanent domain, the JVM stores the class and method objects. In the case of configuration, a permanent domain is a stand-alone domain and is not considered part of the heap.
After the jar file is loaded, it may be placed in a permanent domain and will not be freed by GC dynamics.
JVM permanent domain default Java.lang.OutOfMemoryError:PermGen space exception may occur when only 32m,jar more
Change the size of the permanent domain through the following configuration
Set java_opts=%java_opts%-xx:permsize=256m-xx:maxpermsize=512m

4. Recommended for one-time configuration in Tomcat's Catalina.bat file
Set java_opts=%java_opts%-xms512m-xmx1024m-xx:permsize=256m-xx:maxpermsize=512m

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.