OutOfMemory: PermGen Space abnormal processing and analysis & myeclipse tomcat out of memory solutions [change]

Java programmers have not encountered OutOfMemory is simply impossible!

Can be seen in the Java world, too many uncertainties to run Java programs directly result in the collapse of a direct throw OutOfMemory exception, and once encountered this problem, investigated, very difficult. In JDK 5.0 before, OutOfMemory only such a sentence: java.lang.OutOfMemory Exception ... basically no start, no way of analysis. From JDK 5.0 on OutOfMemory after a number of additional detailed description of the analysis for this exception provides great convenience.

The problems that will throw OutOfMemory: PermGen Space exception, this exception is very interesting, according to this article】 【description, this is a Sun JVM's bug, since 2003, an up to now no solution . And the proposed solution is to use JRockit. Bug causes have been found, because JVM PermGen Space in the distribution of the time there PermGen Space shortage, by default PermGen size is 64M, not for use in the case of JRockit, you can add a start time JVM parameters:-XX: MaxPermSize = 128m | 256m | 512m.

So what is a PermGen it?

PermGen in fact refer to Permanent Generation, itself is in Java's garbage collection mechanism (GC) generated in concept. Java's garbage collection mechanism is through all the objects first, if we find an object is not referenced, then the recovery, which is in the early Java 1.0 and Java 1.1, when the GC rules. Slowly, such a "stupid" GC algorithm JVM performance became a bottleneck, have large amounts of data in Java applications, GC of the algorithm is highly enhanced, so a variety of efficient algorithms have been developed JVM GC up. J2SE is Java 1.2 from the beginning, JVM introduced a wide range of GC algorithms, one of which is used a lot of Generational Collection, Chinese is called " points on behalf of the collection method . "

Collecting points on behalf of the rejection of all objects traversal, but with some experience in property to avoid extra work (While naive garbage collection examines every live object in the heap, generational collection exploits several empirically observed properties of most applications to avoid extra work ). Which imported the concept of a critical: infant mortality (infant mortality), this means that the more the new generation of variable or object, the more easily be collected. The following figure shows an object life cycle, the horizontal axis that is the test to the object's life cycle, the vertical axis indicates the life cycle on a specified number of objects to be recovered.

OutOfMemory: PermGen Space abnormal processing and analysis & myeclipse tomcat out of memory solutions [change]

Can see that the points on behalf of the collection method used after the object is to collect the young generation of the highest rates. And the object in memory will be in accordance with the different "ages" to divide, when the object of a full age after age in the garbage collection will occur on, starting from the younger generation has been to the "eternal generation" , in memory, all objects can be divided into many generations, the last generation of "eternal generation" is the "Permanent Generation", here is a direct lead to "Permanent Generation" concept of place. Specifically to refer to the diagram:

OutOfMemory: PermGen Space abnormal processing and analysis & myeclipse tomcat out of memory solutions [change]

According to the situation said earlier in the sub-cases on behalf of garbage collection will have the concept of Permanent Generation, and this sub-generation of garbage collection method is a collection of parallel and concurrent basis to collect, so Permanent Generation will always exist, then the Permanent Generation Is What are they used for? Save the JVM where the class of all objects, including information like metadata, as well as methods of description, etc., so this generation of memory garbage collection algorithm is not the same as in the case of large program Java, especially J2EE or Java EE applications on large-scale, Permanent Generation of size can be loaded directly limit the number and size of the class.

】 【Solution is to set the JVM startup parameters, you can set up as follows:

java-XX: PermSize = 64m-XX: MaxPermSize = 128m

Also PermSize and MaxPermSize if the same can also be set to a certain extent, improve performance, because, PermSize in constant change which will need to transfer the data. If fixed later, you can reduce the time to expand PermSize performance loss.

See more 】 【Java Official site

In addition, you can also add the following Java startup parameters see GC's operation:

Java-verbosegc

Tomcat directly start normally, start by myeclipse tomcat out of memory.
MyEclipse start Tomcat ignore catalina.bat set memory size of the problem.
Set in the tomcat's catalina.bat set JAVA_OPTS =- Xms128m-Xmx256m, directly startup.bat start tomcat without problems.
However, configure myeclipse tomcat, passed myeclipse of memory start to appear, before catalina.bat set of memory seems to have no effect.

Settings needed to be done can be solved as follows:

MyEclipse -> Window -> Preference ... -> MyEclipse -> Application Servers ->

Tomcat -> Tomcat 6.X -> JDK -> Optional Java VM arguments: set

Set the content:-Xms256m-Xmx512m
-Dcom.sun.management.jmxremote = true

分类:Java 时间:2010-04-03 人气:543
分享到:
blog comments powered by Disqus

相关文章

  • A comprehensive analysis of Java's garbage collection mechanism 2010-01-29

    Introduction Java run-time heap is a data area, the class instance (object) from which the allocation of space. Java Virtual Machine (JVM) heap storage of the applications that are running all the objects created, these objects through the new, newar

  • Comprehensive analysis of Java's garbage collection mechanism 2010-04-19

    Java heap is a run-time data area, the class instance (object) from distribution space. Java Virtual Machine (JVM) heap storage of the applications are running all the objects created, these objects through the new, newarray, anewarray and multianewa

  • Java's garbage collection mechanism 2010-06-24

    The full text: http://topic.csdn.net/u/20091211/12/c79a9293-fdd5-4f81-b18f-a4a29c8d9be2.html Study: yang677888 (from CSDN) Introduction Java run-time heap is a data area, the class instance (object) from distribution space. Java Virtual Machine (JVM)

  • On Java, the garbage collection mechanism 2010-07-01

    1. Garbage collection is a dynamic storage management technology, which automatically releases the object reference is no longer procedure, according to a particular garbage collection algorithm to auto-recovery function of resources. When an object

  • Java's garbage collection summary and to learn Java garbage collection mechanism for experience 2008-06-09

    Memory is a scarce resource, even if memory, a money one! If the improper use of programming, then the memory will run out of big. First, understand Java's automatic garbage collection garbage collection is one of the major characteristics of Java la

  • Java garbage collection mechanism and the tuning 2010-03-29

    1.JVM an overview of the gc or gc garbage collection mechanism is no longer in use jvm for the release of those occupied by the object of memory. java language does not require the jvm has gc, there is no provision gc how they work. However, commonly

  • JBPM used to resolve issues related to class (1): java.lang.LinkageError Collection 2010-09-12

    JBPM used to resolve issues related to class (1): java.lang.LinkageError collection of related applications when developing JBPM occur when the following exceptions: javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation:

  • JVM garbage collection mechanism and GC Adjustment 2010-03-29

    JVM garbage collection mechanism and GC Adjustment 1, GC Summary: Knowledge of why the JVM heap, said first JVM heap? JVM is a Java object heap space for activities, procedures, objects in the class from which the allocation of space, its stores are

  • Garbage collection mechanism 2010-04-14

    In the past year, had their own little concerned about the Java technology, the latest to see, do not let your behind the times! Google queries in a moment, the article on the garbage collection mechanism, integrated a bit, as follows: 1. Tags - Clea

  • Android's garbage collection mechanism (android refbase class (sp wp)) 2010-08-09

    The implementation of sp and wp ~ ~ Personally feel that the sp and wp is actually android for c + + implementation of automatic garbage collection mechanism , specific to the internal implementation, sp and wp is really just an implementation of gar

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.625 (s). 10 q(s)