课程: Java Memory Management: Values and References
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Heap memory
- [Instructor] The heap memory holds all the objects that exist in the application. Objects on the heap can be accessed from everywhere in the application using the address of the object. We call this address, the object reference. The objects on the heap contain the same thing as the blocks of method memory on the stack, primitive values and references to other objects on the heap. So let's have a look at a visualization to understand how does this is working. So this is our heap memory and on our heap, we have one object. And this object contains primitives and references to other objects on the heap. And then we have Object 2 on our heap. And Object 2 on the heap also holds primitives and references to other objects on the heap. And finally, we have a third object on our heap, which is containing primitives and references as well. So these elements on the heap, they actually need to hold some sort of connection to the stack. So here we see that our Method 1 is actually referencing…