Several outofmemory Solutions

Source: Internet
Author: User
Several outofmemory solutions:
1. java. Lang. outofmemoryerror: permgen Space
Permgen space is called permanent generation space, which refers to the permanent storage area of the memory outofmemoryerror: permgen space. In terms of text, memory overflow occurs. The solution is to increase the memory. Why is the memory overflow? This is because the memory is mainly used by JVM to store class and meta information. When the class is loaded, it is placed in the permgen space area, unlike the heap region where the instance is stored, GC (garbage collection) does not clean up permgen space during the main program running, so if your app loads a lot of classes, the permgen space error may occur. This error is common when the web server pre-compile the JSP. If your web app uses a large number of third-party jar files and the size exceeds the default JVM size, this error message is generated.
Modify tomcat_home/bin/Catalina. Sh
Add the following lines to "Echo" using catalina_base: $ catalina_base:
Java_opts = "-server-XX: permsize = 128 M-XX: maxpermsize = 128 m

If it is started in eclipse, you can set:


2. java. Lang. outofmemoryerror: Java heap Space
The JVM heap setting refers to the setting of the memory space that JVM can allocate during Java program running. The JVM automatically sets the heap size value at startup. The initial space (-XMS) is 1/64 of the physical memory, and the maximum space (-xmx) is 1/4 of the physical memory. You can use options such as-xmn-XMS-xmx provided by JVM to set the configuration. The heap size is the sum of young generation and tenured generaion. This exception is thrown if 98% is used for GC and the available heap size is less than 2% in JVM.
Add the following lines to "Echo" using catalina_base: $ catalina_base:

Java_opts = "-server-xms800m-xmx800m-XX: maxnewsize = 256 m"

JVM new generation, permanent generation model can refer to the http://blog.csdn.net/kingofworld/article/details/17718587

JVM parameters:
-XX: + printgcdetails: print the garbage collection information
-XMS is the initial value of the heap region. The online environment must be consistent with-xmx. Otherwise, the capacity value will float back and forth.
-Xmx is the maximum value in the heap region.
-The XSS (or-SS) thread stack size (indicating the native space of a thread) is the default size of 1 MB after 1.5
-XX: permsize and-XX: initial size and maximum value of the maxpermsize (permanent generation) Method Area (but not the local Method Area)
-XX: Ratio of newratio to the new generation
-XX: the proportion of occupied vorratio Eden to vor. For example, 8 indicates that a vor zone occupies 1/8 of the Eden memory, that is, 1/10 of the New Generation memory. Why is it not 1/9? Because our new generation has two pair vor, namely S1 and s22. Therefore, VOR occupies 2/10 of the memory of the new generation, while Eden accounts for 8/10 of the new generation.
-XX: After maxheapfreeratio GC, if the estimated percentage of idle heap memory to the whole is smaller than this value, the heap space will be reduced.
-XX: After minheapfreeratio GC, if we find that the percentage of idle heap memory in the whole estimate is greater than this value, the heap space will be increased.
-XX: newsize: New Generation size

Several outofmemory Solutions

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.