"In-depth understanding of the Java Virtual Machine," study notes - the memory area

"In-depth understanding of the Java Virtual Machine," study notes - the memory area

Runtime data area

It is divided into six parts:

  1. Program Counter
  2. VM stack
  3. Native method stacks
  4. Java heap
  5. Methods district

as the picture shows:

The program counter (thread-private)

  1. The program counter is the current bytecode execution thread line number indicator
  2. When the bytecode interpreter is working by changing the value of the counter byte code to select a next instruction to be executed
  3. To post a thread switch can be restored to the correct location of execution, each thread requires a separate program counter
  4. Java execution method, the counter records the address of the virtual machine bytecode instruction being executed; Native method is performed, the counter is empty
  5. The program counter is the only one that will not appear in the Java Virtual Machine in the OutOfMemoryErrorregional context

Java Virtual Machine stack (thread-private)

  1. Each method will be executed when at the same time create a stack frame
  2. 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
  3. "Stack memory" refers to the local variable table portion of the virtual machine stack
  4. Local variable table stored in the basic data types
  5. During the completion of the required local variable allocation table memory space recompilation
  6. StackOverflowError : Thread request stack depth greater than the depth allowed by the virtual machine
  7. OutOfMemoryError: Stack dynamically expanding virtual machines can not apply to enough memory

Native method stacks (thread-private)

  1. Running a local method
  2. Other similar stack and the Java Virtual Machine

Java heap (threads share)

  1. Created when the virtual machine starts
  2. Storage object instance
  3. The main area of ​​garbage collection

The method area (threads share)

  1. Class information storage virtual machine has been loaded, a constant, static variables, i.e., the compiler code, etc. Data
  2. Uninstall constant pool of recycling and type of

Guess you like

Origin www.cnblogs.com/weixuqin/p/11391169.html