JVM - Memory Management

JVM memory management is mainly divided into two blocks, each block which will be divided into respective portions

1. Thread shared area - equal to all the threads share some content

  • This Code is a code reader program is run for managing and recording currently running - the calculator program
  • Stack 
    • Java Virtual Machine stack, dynamic memory model execution method, each method creates an execution stack for recording local variable table, the operand stack, dynamic links, and so on for export, the local variable table in the process of compiling, it has been allocated good memory, during operation will not change the size of the local variables, usually if you encounter an infinite loop, will appear StackOverFlowError
    • Native method stacks, and the Java virtual machine stack similar, the difference is, the Java virtual machine for the method JAVA services, native method stacks, native method is to provide services  

2. Thread the exclusive area - equal in this thread, some of their own unique content

  • Heap - stored instance of an object, the garbage collector is the most important area
  • Methods district - loaded class information, constants, static variables, real-time code compiler, which have a constant pool area method
    • Runtime constant pool - "abc" This will create a string stored in the constant pool which, if new String ( "abc") will be stored on the heap

 

Guess you like

Origin www.cnblogs.com/oscar1987121/p/10926577.html