Original Title:JVM Run-Time Data Areas
Refer:
Each thread has a separate data zone (not shared among threads). Each thread has a separate memory zone, which includes the program counter register ), JVM Stack and Native Method Stack ). When a new thread is created, the memory is allocated.
Program counter: in order to restore the thread to the correct execution position after switching, each thread requires an independent program counter. The counters between threads do not affect each other and are stored independently. JVM Stack: its structure is shown in:
Java code.
The heap and method zones shared by all threads are shared by all threads.
Heap zone: This is the most common area for storing arrays and objects. This part of memory exists at JVM startup. The garbage collector (GC) works in this region.
Method Area: used to store the run-time constant pool ).
Runtime constant pool: it is the expression of every class or interface constant, including several constants, including values that are known during the compilation period and those that are only known during parsing.
The stack consists of frames. When a method is called, the corresponding frames will be pushed to the stack. The frame contains local variables, the operand stack, and references pointing to the constant pool.
Http://www.programcreek.com/2013/04/jvm-run-time-data-areas/.