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

sponsored links
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:


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
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

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

  • An essential reference resource list of Java

    Since the Java platform since 1995 as a whole began to introduce programming community, and its development has gone far beyond the early Java experts and those who promote the idea of "applet ubiquitous" of that vision. In contrast, Java emerge

  • hibernate how to store binary, image and other major fields.

    model categories: reportByte binary type for the database fields. public class PfReportStyle implements java.io.Serializable , Cloneable { // Fields /** * */ private static final long serialVersionUID = 1L; private Long id; private byte[] reportByte; // C

  • Talk about the "design mode"

    Now more and more frameworks; model appears to reduce the use of the opportunity, then mean that we do not have to grasp the mode of the case? In fact, in order to study the actual training model mode of thinking, modes of thinking help to understand ...

  • NoClassDefFoundError: javax / servlet / Servlet

    In the project in order to achieve a listener in web.xml set up a listener, did start in Tomcat actually occurred after java.lang.NoClassDefFoundError: javax / servlet / ServletContextListener this anomaly google and found the reasons for the lack of serv

  • How the primary key agent-hibernate

    Existing Table A, B Statement: A, B field id-based keys. A: [id, name] B: [id, Aid, title] B and A's set up a many-to-one relationship because of A, B two tables are the primary key id field so add B when Hibernate will automatically retrieve id ...

  • java read file

    java read documents in two ways: java.io and java.lang.ClassLoader When using the java.io, when java.lang.ClassLoader use it? (Note: If prior to read xml file java read file clearly aware of these two methods have been like! Can take much less to understa

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • Some interview questions java

    The first is the company give you a chance to meet, it is necessary to know to meet from time to equal the interview, and have a lot of companies to see you at the first time will give you a ready point of doing something trivial, these questions, althoug

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Great collection of java interview topics

    1, object-oriented features of what has 1. Abstract: Abstract is that it has overlooked a subject has nothing to do with the current goal of those aspects in order to more fully with the current objectives of the attention-related aspects. Abstract does n

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries