0

In Oracle's Java Virtual Machine's Garbage Collector, what are the respective roles of "survivor 1" and "survivor 2" ?

Are the objects always moving like: Eden → Survivor 1 → Survivor 2

Or can an object jump directly from Eden to Survivor 2?

Would a "Survivor 3" make no sense, or it could be OK but it was deemed that two are enough?

Nicolas Raoul
  • 1,334
  • 7
  • 22
  • 43

1 Answers1

2

Survivor1 and Survivor2 are used alternately. Minor GCs scan everything in one survivor space, and move anything that's still needed into the other one, so exactly two are needed.

Mike Scott
  • 7,993
  • 31
  • 26