Article Directory
JVM memory map
Heap
The sole purpose of this memory area is to store object instances, and almost all object instances allocate memory here.
Described in the JVM virtual machine specification:All object instances and arraysMust be allocated on the heap.
Stack (Virtual Machine Stack)
For storageLocal variableWait.After the method is executed, it will be released automatically。
Method Area
For storageClass information, constants, and static variables loaded by the virtual machine、Just-in-time compiler compiled codeAnd other data.
An object memory graph
Three object memory graph
3 objects, of which two references point to the same object