Home >Java >javaTutorial >JVM learning Java runtime data area
The line number indicator of the bytecode executed by the current thread.
Thread private, has the samelifecycle as the thread. Used to store local variable tables, operand stacks, dynamic linked lists, method exits and other information .
Local variable table storage content:
Basic data types (boolean, byte, char, short, int, float, long, double)
Object reference (different from symbol reference, which is stored in the constant pool)
returnAddress type (pointing to the address of a bytecode instruction)
64-bit long and double type data occupy 2 local variable spaces (slots), and the rest occupy 1 slot.
Two exceptions:
StackOverflowError: The stack depth requested by the thread > the depth allowed by the virtual machine
OutOfMemoryError: Unable to apply for enough memory during dynamic expansion
Similar to the virtual machine stack, the difference is that Native Method Stack serves Native methods, and the virtual machine stack serves Java methods.
Shared by all threads, it stores object instances and arrays.
The main area managed by the garbage collector, also called "GC Heap (Garbage Collected Heap)"
includes the new generation (Eden space, From Survivor space, To Survivor space) and the old generation.
Can divide multiple thread private allocation buffers (Thread Local Allocation Buffer, TLAB).
It can be discontinuous physically but continuous logically.
Extensible: -Xmx and -Xms controls. -Xmx maximum heap memory size, -Xms initial heap memory size.
When there is no available memory in the heap to complete the instance allocation, and it cannot be expanded anymore - OutOfMemoryError
is also all threads Shared, used to store class information, constants, static variables, code compiled by the just-in-time compiler and other data that have been loaded by the virtual machine.
is also called "Permanent Generation", but it is not essentially equivalent.
The permanent generation has an upper limit of -XX:MaxPermSize.
is part of the method area.
The NIO (New Input/Output) class newly added to JDK1.4 introduces a method based on channel (Channel) and buffer (Buffer) I/O method, it can use the Native function library to directly allocate off-heap memory. It is not limited by the Java heap size (-Xmx), which may cause the sum of each memory area to be greater than the physical memory limit, causing an OutOfMemoryError to occur during dynamic expansion.
The three memory areas 1, 2, and 3 are private to each thread
4 and 5 are
6 common to all threads is part of 5
#7 is not part of the virtual machine runtime data area, but belongs to the virtual machine's memory area Other physical memory besides
[Related recommendations]
1. java collection framework study notes
2. Introducing two code examples for calculating java running time
3. Java transaction management learning detailed explanation JDBC sample code
The above is the detailed content of JVM learning Java runtime data area. For more information, please follow other related articles on the PHP Chinese website!