When I looked at the JVM principle yesterday, I briefly summed up the data region of the Java Runtime:
1. Program counter
A program counter is a small amount of memory space that can be viewed as a signal indicator of the byte code executed by the current thread. In the virtual conceptual model, the bytecode interpreter works by changing this counter
Value to select the next command to execute, the base functions such as branching, looping, instruction, exception handling, thread recovery, and so on, need to rely on this counter.
2. Java Virtual machine stack
A reference to a class is stored in the stack
3. Local Method Stack
4. Java Heap
The largest chunk of memory managed in a Java virtual machine, the Java heap is an area that is shared by all the thread locks and created when the virtual machine is started. The only purpose of this memory area is to hold an object instance if the heap does not have
The memory completes the instance assignment, and the heap cannot be extended, and an Oom exception is thrown.
5. Method area
A thread-shared memory area used to hold class information, static variables, constants. An abnormal oom is thrown when the method area cannot satisfy the memory allocation.
Java run-time data region