Home > Java > Javagetting Started > body text

What are the runtime data areas in JVM

王林
Release: 2019-11-26 11:10:26
forward
2798 people have browsed it

What are the runtime data areas in JVM

First look at the picture:

What are the runtime data areas in JVM

java related video tutorial: java course

1. Program counter (PC)

is exclusive to threads. It is a smaller piece of memory and is the line number indicator of the bytecode executed by the current thread. It is the only area in the Java virtual machine specification that does not specify OOM (OutOfMemoryError).

2. The Java virtual machine stack

is exclusive to threads. The life cycle is the same as that of threads. Is the memory model for Java method execution. Execution of each method creates a stack frame that stores local variables and operands (object references). The memory space required for local variables is allocated during compilation. So the size of the stack frame will not change.

There are two exceptions:

1) If the thread request depth is greater than the stack depth, a StackOverFlowError will be thrown.

2) If the stack cannot request enough memory when dynamically expanding, OOM will be thrown.

3. Heap

The Java heap is shared by all threads. It is created when the virtual machine is started. Stored are instances and arrays of objects. The largest memory occupied. It is divided into the new generation (Young area) and the old generation (Old area). The new generation is divided into Eden area and Servior area. The Servior area is divided into From space area and To space area. The memory ratio between Eden area and Servior area is 8:1. When the extended memory is larger than the available memory, OOM will be thrown.

What are the runtime data areas in JVM

4. Local method stack

The local method stack is exclusive to threads. Similar to the Java virtual machine stack, but instead of serving Java methods (bytecode), it serves native non-Java methods. StackOverFlowError and OOM will also be thrown.

5. Method area

The method area is shared by all threads. Used to store class information, constants, static variables and other data that have been loaded by the virtual machine, also known as Non-Heap. The method area is also called the "permanent generation". GC is rarely performed in this area, but it does not mean that it will not be recycled. The goal of this area recycling is mainly for the recycling of the constant pool and the unloading of types. When the memory request is larger than the actual available memory, OOM will be thrown.

Recommended articles related to java: Getting started with java

The above is the detailed content of What are the runtime data areas in JVM. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
jvm
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template