Limit exceeded solution for Java.lang.OutOfMemoryError:GC overhead

Source: Internet
Author: User
Tags gc overhead limit exceeded

The exceptions are as follows: Exception in thread "main" Java.lang.OutOfMemoryError:GC overhead limit exceeded


First, explain: JDK6 new error type.

This exception is thrown when the GC takes up a lot of time to free up a small space

That is, Sun's official definition of this is that this exception is thrown when more than 98% of the time is spent on GC and when less than 2% of the heap memory is recycled.

This is typically because the heap is too small to cause an exception: there is not enough memory.


Second, the solution:

1, to see if the system has the use of large memory code or dead loop.

2, you can add the JVM's startup parameters to limit the use of memory:-xx:-usegcoverheadlimit

The method is as follows: In the Linux environment, add to the Cygwin=false line in Tomcat's catalina.sh file

Java_opts= "-xms512m-xmx2048m-xss1024k-xx:permsize=256m-xx:maxpermsize=512m-xx:-usegcoverheadlimit"

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.