JVM Version 1.7:
The JVM's memory is divided into heaps and non-heap two parts.
Heap:
The heap is divided into Cenozoic and old age. Generic objects are created in the new generation of memory, and the objects in the Cenozoic are still alive after several GC recoveries (this number can be set) and moved to the old age. A GC is triggered when there is insufficient memory in the Cenozoic and older generations. The new generation of GC methods are generally replicated, while older generations are marked clean-up. method is different when used according to the characteristics of the memory of these two generational regions.
-xms512m heap initialized memory size,-xmx1024m heap maximum memory for 1024m-xmn512m cenozoic space size.
Non-heap:
Program counter: Used to record which step the thread performed (logging instructions). So each thread will have a separate counter.
Virtual Machine Stack: The information that is logged when the method is run is also thread-independent. -xss128k sets the depth of the line stacks (that is, the amount of memory the thread can use), and throws stackoverflowerror when it is exceeded.
Local method Stack: the same as the virtual machine stack, but for the native method.
Method Area: That is to say the permanent generation, used to store classes of information, constants, static variables, JIT compiled code, such as real-time. GC may not be implemented, but it will generally be. For example, class unloading will also be recycled
-xx:maxpermsize=256m set the maximum free space for the permanent generation.
string constant pool: Before JVM 1.7 is placed in the method area, 1.7 moves out of the method area, so it is no longer restricted by the MaxPermSize parameter.
Local memory: The rest of the native memory, this part of memory is not the JVM specification of memory, but the Java runtime will still use these memory, such as multi-threading, string constants, etc. will increase consumption, if not enough will OutOfMemoryError
JVM Memory Distribution