Why serial gc evacuates the whole heap rather than just To+Old spaces?

Thomas Schatzl thomas.schatzl at oracle.com
Sat May 25 18:25:16 UTC 2019


Hi,

On Sat, 2019-05-25 at 20:13 +0800, kelthuzadx wrote:
> Hi I'm reading the hotspot serial gc source code recently, but I've
> had a puzzling problem. As I understand, FastScanClosure would copy
> objects from Eden+From spaces or promote to old generation when age
> was reached to threshold. After this phase, only To+Old spaces has
> object reference, which means we can evacuate their followers from
> these spaces. Why [FastEvacuationFollowersClosure](
> 
http://hg.openjdk.java.net/jdk/jdk12/file/06222165c35f/src/hotspot/share/gc/serial/serialHeap.inline.hpp#l33
> ) evacuates the whole heap rather than just To+Old space?

  can you clarify your question?

The code you referenced seems to do exactly what you suggest it should
do above. It iterates over the objects pulled from the roots into
survivor/old to potentially pull the objects they reference.

If you look at the caller e.g. in DefNewGeneration, it is called until
no more evacuations occur.

Thanks,
  Thomas 




More information about the hotspot-gc-dev mailing list