Partitions of data during Java virtual machine running hours and Java Virtual Machine regions
Java virtual machine data runtime Region
Method Area)
Stores loaded class information, constants, static variables, compiled code, and other data. Although the JVM specification describes the method area as a logical part of the Heap, it has an alias called Non-Heap. In addition to the description information such as the version, field, method, and interface of the Class file, the Class file also contains the constant pool, which is used to store various literal quantities and symbol references generated by the compiler, including string constants. After the JVM loads the Class, it puts the data in the constant pool into the runtime constant pool. The data during running in the method area (including the runtime pool) isThread-shared.
Heap (Java Heap)
Heap isThread-sharedA memory area created at JVM startup. All object instances and arrays need to be allocated memory here, but with the development of the JIT compiler, it gradually becomes less absolute.
Java Virtual Machine Stack)
Describes the Memory Model of Java method execution. Each method creates a stack Frame (Stacks Frame) during execution to store information such as the local variable table, operand stack, dynamic link, and method exit. The process from calling to execution completion of each method corresponds to the process from a stack frame to an output stack in the JVM stack. A local variable table is a storage space for variable values. It is used to store local variables defined in method parameters and methods. The required memory space is allocated during compilation. When entering a method, this method needs to allocate a certain amount of local variable space in the stack frame, the table size of local variables is not changed during method running. The capacity of the most local variable table is in small units of the variable Slot, A Slot in a 32-bit virtual machine can store data types of up to 32 bits (boolean, byte, char, short, int, float, reference, and returnAddress ). A virtual machine uses a local variable table to pass parameter values to the Parameter Variable list. If the instance method is not static ), the Slot of the 0th-bit index of the local variable table is used by default to pass the reference of the object instance to which the method belongs, and is accessed through this in the method. Virtual Machine stack isExclusive thread.
Native Method Stack)
Similar to the JVM stack, the difference is that the JVM stack executes Java method services for JVM, and the local method stack serves Native methods used by JVM. YesExclusive thread.
Program Counter (Program Counter Register)
A small memory space can be seen as the row number indicator of the bytecode executed by the current thread. the bytecode interpreter selects the next bytecode instruction by changing the counter value. Each thread hasIndependentCounter.
Java Learning Group 669823128