"In-depth understanding of the Java Virtual Machine," study notes - the memory area
Runtime data area
It is divided into six parts:
- Program Counter
- VM stack
- Native method stacks
- Java heap
- Methods district
as the picture shows:
The program counter (thread-private)
- The program counter is the current bytecode execution thread line number indicator
- When the bytecode interpreter is working by changing the value of the counter byte code to select a next instruction to be executed
- To post a thread switch can be restored to the correct location of execution, each thread requires a separate program counter
- Java execution method, the counter records the address of the virtual machine bytecode instruction being executed; Native method is performed, the counter is empty
- The program counter is the only one that will not appear in the Java Virtual Machine in the
OutOfMemoryError
regional context
Java Virtual Machine stack (thread-private)
- Each method will be executed when at the same time create a stack frame
- Each method is called until the completion of the execution process, corresponding ones of a stack frame on the process from push to re-play the virtual machine
- "Stack memory" refers to the local variable table portion of the virtual machine stack
- Local variable table stored in the basic data types
- During the completion of the required local variable allocation table memory space recompilation
StackOverflowError
: Thread request stack depth greater than the depth allowed by the virtual machineOutOfMemoryError
: Stack dynamically expanding virtual machines can not apply to enough memory
Native method stacks (thread-private)
- Running a local method
- Other similar stack and the Java Virtual Machine
Java heap (threads share)
- Created when the virtual machine starts
- Storage object instance
- The main area of garbage collection
The method area (threads share)
- Class information storage virtual machine has been loaded, a constant, static variables, i.e., the compiler code, etc. Data
- Uninstall constant pool of recycling and type of