Memory analysis - stack, heap, the method area

table of Contents

Stack (stack)

Heap (heap)

Method zone (method area)


Stack (stack)

0, automatically assigned consecutive space

1, is a method of performing stack memory model described. Each method is called a stack frame is created ( stored local variables , operands, the method exports)

2, JVM creates a stack for each thread, storing information for performing a method of the line (the actual parameters, local variables, etc.)

3, the stack belong thread private , shared between threads can not be achieved

4, the storage characteristics of the stack: last out, LIFO

 

Heap (heap)

0, the heap is not continuous memory space, flexible distribution, slow

1, good for storing all creation (new) objects (arrays are objects)

2, JVM only a heap , are all shared thread

 

Method zone (method area)

0, The method of heap area actually only for storing class information associated constants

1, storing the same or unique content : Class objects, static variables, string constants

 

Published 38 original articles · won praise 6 · views 1913

Guess you like

Origin blog.csdn.net/weixin_43827227/article/details/99705913