The memory managed by the Java Virtual Machine includes the following runtime data areas:
Program Counter (PCR):
1, is a small memory space, can be seen as the current thread executes the byte code of the line number indicator
2, for thread-private
3, the implementation of the Java method has PCR, when the native method is performed, PCR is empty (Undefined)
4, the memory area does not appear ome (out of memory Exception)
Java Virtual machine stack:
1, each thread is private, the life cycle is the same as the thread
2, JVMs Describes the Java method execution of the memory model, the local variable table, the operand stack
3. The local variable table stores the base type, object, and return address type, and long and double types account for two slots
4, presence of SOE (Stackoverflowerror) and ome
Local method Stack:
1. Local method service for virtual machine
2, the virtual machine specification to the local method stack no specific provisions, the specific virtual machine can freely implement the provisions
3, with SOE and ome
Java heap:
1. The largest chunk of memory, all threads shared, VM startup created, sole purpose: Storing object instances
2, also become GC heap, is the main area of garbage collector management
3, the GC heap can be in a physically discontinuous memory space, as long as the logical continuous can
4, there are ome
Method Area:
1, all thread sharing, storage has been loaded by the virtual machine class information, constants, static variables, the real-time compiler compiled code and other data
2, alias non-Heap, is a logical part of the heap
3, memory logic continuously, you can choose fixed size or extensible, or do not want to garbage collection
4, there are ome
To run a constant-rate pool:
1, is part of the method area, storage class file, constant pool information
2, dynamic, you can put the constant in the pool during the run or compile period
3, there are ome
Direct Memory:
1. Is the out-of-heap memory allocated directly using the native library, and the DBB (Directbytebuff) object in the Java heap as a reference to this memory
2. will be subject to native memory limit
3, there are ome
Deep understanding of Java Virtual Machine (i), Java memory area and memory overflow exception