课程: Java Memory Management: Garbage Collection, JVM Tuning, and Spotting Memory Leaks
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Eligible for garbage collection - Java教程
课程: Java Memory Management: Garbage Collection, JVM Tuning, and Spotting Memory Leaks
Solution: Eligible for garbage collection
(upbeat music) - [Instructor] Your job was to mark the objects eligible for garbage collection, and here's how to do that. On line 23, it's indicating that it is done processing, so after that, we no longer need to keep the object. So in this case, we implemented the release object by setting it to null. There's no use for calling System.gc. That's not marking it for garbage collection. What is marking it for garbage collection is when it's no longer having a relation to the heap, and here we're doing that by setting the reference that we're having to null. So if I go ahead and run this code, you can see that it validates, and it's saying you did it. The result is exactly right.
内容
-
-
-
(已锁定)
Introduction to the garbage collector2 分钟 38 秒
-
(已锁定)
Eligible for garbage collection1 分钟 39 秒
-
(已锁定)
Garbage collection phase: Marking2 分钟 23 秒
-
(已锁定)
Garbage collection phase: Sweeping2 分钟 39 秒
-
(已锁定)
Different generations on the heap6 分钟 3 秒
-
(已锁定)
Generational garbage collection2 分钟 51 秒
-
(已锁定)
Different garbage collection implementations5 分钟 15 秒
-
(已锁定)
Monitoring garbage collection3 分钟 14 秒
-
(已锁定)
Solution: Eligible for garbage collection45 秒
-
(已锁定)
-
-
-