1. Program Counter:
is a small memory space that can be viewed as a line number indicator executed by the current thread, and the byte code parser, when working, selects the next byte-code instruction that needs to be executed by the value of the variable program counter. The basic functions of a program's branch-loop jump, exception handling, and thread recovery are all dependent program counters.
Java Virtual machine Your multithreading switches through threads and allocates processor time bias to achieve, at any one time, a processor will only execute a thread instruction, therefore, in order to ensure that the thread switch can only restore to the correct execution position, each thread needs a separate program counter, Therefore, the program counter is thread-private memory.
The program counter is the only memory area in the Java virtual machine that does not have a specified memory overflow outofmemoryeoor.
2, Java Virtual machine stack.
The Java Virtual machine stack is also thread-private, and its lifecycle is the same as the thread. The virtual machine stack describes the memory model that the Java method executes. Each method creates a stack frame at the same time when it is executed to hold the local variable table, the operand stack,
3: Local method stack.
The local method stack is very similar to the Java Virtual machine stack, and the difference is that the Java Virtual machine stack is a Java method service for the virtual machine, and the local method stack is the operating system local method service that is invoked for the virtual machine.
The Java Virtual Machine specification does not enforce the local method stack implementation and data structure, and the virtual machine directly combined the Java Virtual machine stack with the local method stack.
4. Heap:
The heap is the largest of the memory areas managed by the Java Virtual Machine sun, and the Java heap is an area of memory that is shared by many, and is created when the Java Virtual machine is started, and the only purpose of heap memory is to store object instances. Almost all object instances are allocated in heap memory.
5, Method area.
A method area, like a heap, is a memory area shared by individual threads that stores data such as class information, constants, variables, blockbuster variables, and timed compiled code that have been loaded by the virtual machine. Although the Java Virtual Machine specification describes the method area as a logical part of the heap, the method area has an alias called a heap.