JVM Memory Area Model:
* Program counter, Memory area is very small, is the current thread bytecode execution line number indicator;
* The virtual machine stack, The local method stack, which is usually referred to as the "stack", is the virtual machine used to execute methods (including java, Non-java methods), The use of temporary memory space to store the current method, local variables, and so on, all basic type variables, as well as the class object references are stored in the stack;
* Method area, Global shared zone, used to store class information that has been loaded by the virtual machine, constants (such As string literal constants), static variables, and compiler-compiled code;
* heap, the largest chunk of memory in Java Virtual machine management, shared by all threads, used to store all Java class Instances. Note that the instance data opens up memory in the heap, and the reference to the object is equivalent to a pointer stored in the stack of THREADS.
Create an Object
Person Person1=new person ("John", 20);
1. The person person1=null in the stack memory;
2. New person in heap memory ("John", 20);
3 initialization, The Person1 reference pointer (pointer in the Stack) points to the new person in heap memory ("John", 20);
==================================================
http://blog.csdn.net/yangyuankp/article/details/7651251
Java Memory allocation