This is the fourth article in this series, related articles list: OutOfMemoryError series (1): Java Heap Space OutOfMemoryError series (2): GC overhead limit exceeded outofmemory Error series (3): PermGen Space OutOfMemoryError Series (4): Metaspace
The JVM limits the maximum memory of the Java program, and modifying/specifying startup parameters can change this limitation. Java divides heap memory into sections, as shown in the following illustration
Objective:As a result of the recently written program after running for a period of time after the high CPU, and then not to be used to troubleshoot, and finally to locate due to metaspace caused FULLGC, constantly fullgc and occupy a large number of CPUs resulting in the program eventually unusable. The following is the process of analysis and summary, easy to later temperature, but also hope to be able to meet the same problems of students some refe
1. Background2. Why abandoned permanent generation (PermGen)3. In-depth understanding of meta-space (Metaspace)4. Summary======== Text Split Line =====First, the background 1.1 permanent generation (PermGen) where?According to this, the hotspot JVM structure is as follows (the virtual machine stack and the local method stack are up):Quoted from the network, but there is a problem: both the method area and the heap heap are thread-shared memory areas.A
1. Background2. Why abandoned permanent generation (PermGen)3. In-depth understanding of meta-space (Metaspace)4. Summary======== Text Split Line =====First, the background 1.1 permanent generation (PermGen) where?According to this, the hotspot JVM structure is as follows (the virtual machine stack and the local method stack are up):Quoted from the network, but there is a problem: both the method area and the heap heap are thread-shared memory areas.A
Multi-image Warning!
Environment: System test (Windows SERVER/JRE8/TOMCAT7)
Symptom: A few days after the application runs, the access timeout occurs and the server CPU utilization is high
Issue log: Outofmemoryerror:metaspace
Problem Analysis:
Cause Analysis: Metaspace is the memory space in which the JVM stores class information, and the possible causes of overflow occur:
Java 8 completely removes the Hotspot JVM from the permanent generation and migrates its original data to Java heap or metaspace. In this article, let's summarize the characteristics of metaspace (meta-space). If there is any mistake, please point out, thank you ~First, Introduction: Why is the permanent generation removed from the hotspot JVM?See: JEP 122:remove the Permanent GenerationThere are two main r
Java 8 completely removes the HotSpot JVM from the Permanent Generation (PermGen), migrating its original data to Java Heap or MetaspaceWhy did you cancel the permanent generation and replace the permanent generation with metaspace? In the HotSpot JVM, the metadata for classes and methods and constant pools, such as and, are used in the permanent generation Class Method . Whenever a class is loaded for the first time, its metadata is placed in the per
").toURI().toURL();URL[] urls = {url};while(true){ClassLoader loader =newURLClassLoader(urls);classLoaderList.add(loader);loader.loadClass("com.paddx.test.memory.Test");}}catch(Exception e) {e.printStackTrace();}}}
Code Snippet 4The results of the operation are as follows:The JDK version used in this example is 1.7, and the size of the specified PermGen area is 8M. By loading the test class each time a different URLClassLoader object is generated, a different class object is generated so
url = null;Listnew ArrayListtry {url = new File("/tmp").toURI().toURL();URL[] urls = {url};while (true){ClassLoader loader = new URLClassLoader(urls);classLoaderList.add(loader);loader.loadClass("com.paddx.test.memory.Test");}} catch (Exception e) {e.printStackTrace();}}}
Code Snippet 4The results of the operation are as follows:The JDK version used in this example is 1.7, and the size of the specified PermGen area is 8M. By loading the test class each time a different URLClassLoader ob
Java8_ from permanent generation to Metaspace JAVA8 has removed the memory area of the permanent generation (Permanent Generation) , and a new memory region meta-space (Metaspace) has occurred. Permanent Generation what does this memory mainly hold? So the Java classes is stored in the permanent generation. What is does that entail? Besides the basic fields of a Java class there is
Methods of a
"Java.lang.OutOfMemoryError:PermGen space" exception. JDK 1.7 is used here because, in JDK 1.8, the HotSpot has no "PermGen space" and is replaced by something called metaspace (meta space). Let's take a look at the difference between Metaspace and PermGen space.Three, metaspace (yuan space)From the above, the removal of the permanent generation has started from
Noun concept:Meta-space: Metaspace1, most of the class metadata is allocated in local memory.2, by default, the class metadata is limited only by the available local memory (the capacity depends on the available virtual memory size of the 32/64-bit operating system).3, the new parameter (maxmetaspacesize) is used to limit the size of local memory allocated to the class metadata. If this parameter is not specified, the meta-space is dynamically adjusted as needed at run time.4, garbage collection
Original address: https://www.cnblogs.com/paddix/p/5309550.html
One, JVM memory model
According to the JVM specification, JVM memory is divided into five parts: virtual machine stack, heap, method area, program counter, local method stack.
1,
of the PermGen area required by the
application is difficult to predict, the setting is too small to trigger PermGen outofmemoryerror errors, and excessive provisioning results in wasted resources.
promotes GC performance, and each garbage collector in the hotspot requires specialized code to handle the metadata information of classes stored in PermGen. Separating the metadata information from the PermGen class into Metaspace, because
because JDK 8 has removed the permanent generation and replaced it with metaspace, in JDK 8, the following two examples do not cause java. lang. OutOfMemoryError: PermGen space exceptions.
Running frequent volume pool overflow
In Java 1.6 and earlier versions of the HotSpot JVM, there is a concept of permanent generation, that is, the GC generational collection mechanism is extended to the method area. in the method area, some memory is used to store
Heap size can be set by MS, MX, and PermGen can be set in Java option by PermSize, Maxperm. One obvious problem with the previous JVM was that you set the ? Xx:maxpermsize oom ( out of Memory " Span style= "font-family: Song body; Background-color:white ">" error, of course, this design will appear in addition to oom bug and performance issues, such as: http://bugs.java.com/view_bug.do?bug_id=6962931Therefore, in the Java 8 design, Oralce and the Java community abandoned the PermGe
a memory leak is the result, otherwise it can only increase the size of the PermGen, for example, the following example, is set PermGen maximum space is:java -XX:MaxPermSize=256m com.mycompany.MyApplicationMeta Data area (METASPACE)Since the space required for estimating metadata is so complex, Java 8 removes the permanent generation (Permanent Generation) directly and instead metaspace. Since then, many a
Translation Https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent G1 garbage collection permanent generation and Metaspace JDK7: Permanent Generation
In JDK7, the permanent generation persists, only to remove part of the content at this time the symbolic reference (symbols) is moved to the native heap; The literal amount (interned strings) moves to the Java heap; The static variable (class statics) of the class is moved to the Ja
); Loader.loadclass ("Com.paddx.test.memory.Test"); } } Catch(Exception e) {e.printstacktrace (); } }}The results of the operation are as follows:The JDK version used in this example is 1.7, and the size of the specified PermGen area is 8M. By loading the test class each time a different URLClassLoader object is generated, a different class object is generated so that we can see the familiar "Java.lang.OutOfMemoryError:PermGen space" exception. JDK 1.7 is used here because, in JDK 1.8,
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.