课程: Java Memory Management: Garbage Collection, JVM Tuning, and Spotting Memory Leaks

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Garbage collection phase: Sweeping

Garbage collection phase: Sweeping

- [Instructor] After the marking of the life objects, it's time to delete the leftover objects that were not marked. This deletion is called sweeping in the garbage collection slang. And of course it wouldn't be fun if we only had one way of sweeping. Instead we have three options for sweeping, normal sweeping, sweeping with compacting and sweeping with copying. Let's start out normal. So let's look at this memory here and say that these bits, they are not marked and so they can be deleted. This is what happens after deletion. It's the old memory but with the available blocks of free space in between. So if we want to store a new bit like this one, the JVM is going to have a look at heap and it's going to figure out that it can be stored over there like this. But say, we'd like to store a bit of a bigger one. Then it cannot fit in between the gaps. So it can be stored at the end over there like this. And say, we want to store an even bigger value. And technically there would be enough…

内容