The difference between JVM heap and stack
- 2020-06-12 08:55:41
- OfStack
Stack memory:
The program runs in stack memory What's stored on the stack are the basic data types and references to objects in the heap The stack is the unit of runtimeThe stack solves the running problem of the program, how does the program execute, or how does it handle the data 1 thread 1 independent thread stack
Heap memory:
Most of the data needed to run the program is stored in stack memory Objects are stored in the heap The heap is the unit of storage, and the heap is just one block of Shared memory The heap solves the data storage problem, which is how and where to put the dataAll threads share heap memory
Parameter passing in Java (what about passing values? Or is it a quote? ) :