java runtime data area-----java virtual machine stack + local method stack + java heap + method area + runtime constant pool

Java virtual machine stack: The virtual machine stack describes the memory model of java method execution . Each method will create a stack frame at the same time as it is executed, which is used to store information such as local variable table , operand stack , dynamic link and method exit . So the Java virtual machine stack is also thread-private .

Local variable table: Stores various basic data types and object references known to the compiler . The long and double types of data will occupy two local variable spaces, and the rest only occupy one. The memory space required by the local variable table is allocated in the compiler. When entering a method, how much does this method need to allocate in the frame? The local variable space of is fully deterministic and does not change the size of the variable table during method execution.

The process from invocation to completion of execution of each method corresponds to the process of stacking a stack frame in the virtual machine stack to popping out of the stack.

Native method stack: The functions of the native method stack and the Java virtual machine stack are very similar. The difference is that the Java virtual machine stack serves Java methods, that is, bytecode files, while the native method stack serves native methods . The Virtual Opportunities combine the two into one.

Java heap: The Java heap is shared by all threads . It is created when the virtual machine is created. It is the largest piece of memory managed by the Java virtual machine. The only purpose is to store object instances. Almost all object instances are allocated here, including all Object instances and arrays, as long as the java heap is logically continuous, the java heap is the main area of ​​the java GC.

Method area: The method area is also shared by threads and is used to store class information, constants, and static variables that have been loaded by the virtual machine . The jvm describes it as a logical part of the java heap. In fact, I prefer to call the method area the permanent generation .

Runtime constant pool: It is a part of the method area. In addition to the description information such as class version, field, method, interface, etc., the Class file also has the runtime constant pool, which is used to store various literals generated during compilation. quantity and symbol reference , this part of the content will be saved in the runtime constant pool after the class is loaded.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325993198&siteId=291194637