Relations with the Java thread stack

Stack is a private thread, each thread its own stack, each thread of each method creates a stack frame for storing local variable table while performing the operand stack, dynamic linking, the method return address, etc. information. Each method call to the procedure is finished, it is a stack frame corresponds to the process in a virtual machine to push the stack from the stack. Wherein the local variable table, storage, references the base type (boolean, byte, char, short , int, float) of the object, etc., reference is not an object instance of the object itself, but a pointer to the object instance.

Heap is shared by the threads, examples and an array of all the objects are stored in the heap, any thread can access. Java's automatic garbage collection mechanism is the use of this area.

The method area is shared by the threads, used to store such information (including the name of the class, method information, field information), the constants, variables, and static-time compiler to compile the code and so on.

Say so abstract, write the code section:

When the program execution when the arrow points to the one line of code,
the parameters i and j are the basic types of local variables, placed directly on the stack.
Str oneMoreStudy into the reference and object type, the object is stored in the stack only by reference.
As shown below:

Guess you like

Origin www.cnblogs.com/heihaozi/p/11741733.html