Data partitions of Java virtual machines
Image.png
Purpose: The row number indicator of the bytecode executed by the current thread.
In the virtual machine conceptual model, when the bytecode interpreter is working, it selects the next bytecode instruction to be executed by changing the counter value, this counter is required for basic functions such as branch, loop, jump, exception handling, and thread recovery.
Note: If the thread is executing a java method, the counter records the address of the Virtual Machine bytecode instruction being executed. If the Native method is being executed, the counter value is empty. This memory region is the only region that does not define any OutOfMemoryError conditions in the Java Virtual Machine specification.
- Java Virtual Machine Stack
The life cycle is the same as the thread. It describes the Memory Model for Java method execution: when each method is executed, a stack frame is created to store information such as the local variable table, Operation stack, dynamic link, and method exit. Each method is called until the execution is complete. It corresponds to the process from the inbound stack to the outbound stack of a stack frame in the VM stack.
In the Java Virtual Machine specification, this region specifies two exception conditions: If the stack depth requested by the thread is greater than the depth allowed by the virtual machine, an StackOverflowError exception will be thrown; if the Virtual Machine stack can be dynamically expanded, an OutOfMemoryError error is thrown when the extended memory cannot be applied.
- Local method Stack
The role of the Virtual Machine stack is very similar. The difference is that the virtual machine stack executes Java method services for the virtual machine, and the local method stack is the Native method service used by the virtual machine.
The exception is thrown in the same way.
Heap
The largest part of memory managed by the Java Virtual Machine. Created when the VM is started, the only purpose of this memory area is to store the object instance.
Heap is the main area of the garbage collector management. From the perspective of memory collection, because the collectors currently basically use the generational collection algorithm, the Java heap can also be subdivided: the new generation and the old generation, the Eden space, the From Region vor space, and the To region vor space.
Java heap can be in physically discontinuous memory space, as long as it is logically continuous.
Method Area
Stores information about classes loaded by virtual machines, constants, static variables, Code Compiled by the real-time compiler, and other data.
Off-topic: pool of runtime durations
A part of the method area is used to store various literal quantities and symbolic references generated during the compilation period. This part of content will be stored in the Method Area runtime pool after the class is loaded.
Minimum heap value-Xms
Maximum-Xmx
MaxPermSize
Method area size parameter-XX: PermSize
-XX: MaxPermSize
The direct memory capacity of the local machine can be specified through-XX: MaxDirectMemorySize. If not specified, the default value is the same as the maximum value of the Java heap (-Xmx.
Join the study exchange group 569772982 to learn and exchange.