课程: Java Memory Management: Values and References
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Garbage collection
- [Instructor] I have mentioned garbage collection quite a few times already. When objects are created in the heap memory they start taking up space, clearly. And at some point we no longer need the objects in our heap memory, and they can be removed. Garbage collection is the removal process of objects on the heap. So, how to start the garbage collector? It's actually quite an elaborate topic that's definitely worth understanding at a very detailed level. But in this course we'll only be covering it briefly. So, you may wonder, when does garbage collection take place? Well, you don't know. Although they don't typically say, okay, but how can I evoke it? Well, you could call system.GC. This is a method. This is merely a suggestion to the JVM that it should start the garbage collection process. And actually, you can not really force the JVM to start garbage collection. So, this is not something that you get to decide as a developer. The JVM will decide when garbage collection should…