Java Memory Partitioning:
In Java memory allocation, Java divides memory into: Method area, heap, virtual machine stack, local method stack, program counter. Where the method area and heap are shared for all threads, and the virtual machine stack and the local method stack have program counters for thread isolation. Each zone has its own creation and destruction time.
Program Counter:
Action is the line number indicator of the byte that the current thread executes. Java multithreading is achieved by rotating threads and allocating processor execution time. Therefore, each thread needs a separate program counter in order to be able to revert to the correct position after switching.
Java Virtual Machine Stack:
Each place is executed at the same time to create a stack frame for the storage of local variables table, operand stack, dynamic link, method of export information. The virtual memory stack is what we often talk about "stacks." Where the memory required for a local variable table is allocated at compile time.
Local method Stack:
Similar to the virtual machine stack, the difference is that the virtual machine stack performs Java method services for the virtual machine, while the local method stack uses the native method service for the virtual machine.
Java Heap:
is shared by all programs and is created when the virtual machine is started. This memory area function is to hold an object instance. According to the Java virtual machine, the Java heap can be in a physically discontinuous memory space, as long as it is logically contiguous.
Method Area:
The same as the heap, shared among the threads. The role is to store data such as class information that has been loaded by the virtual machine, constants, static variables, just-in-time compiler compiled code, and so on.
Run a frequent pool:
is part of the method area. The effect is to store the various literal and symbolic references generated by the compilation period.