Question regarding the need for From/To spaces (vs. simply compacting).

Dawid Weiss dawid.weiss at gmail.com
Wed Jun 23 09:47:53 UTC 2010


Hello there,

A friend of mine asked me a question that I couldn't find any sensible
answer for both in literature, on the Web and by browsing through
OpenJDK source code (but this, I admit, is not easy considering the
volume of code there). The question is:

"Why is the young gen. split between to/from spaces, so that the GC
must copy everything back and forth between two memory regions if only
a single monolithic space would suffice for compacting live objects?"

The only thing I could tell him was that this design decision could be
motivated by the fact that:

- the implementation is simplified since the copied objects end up
either in the TO space or are promoted somewhere else (in case of a
generational GC),
- the implementation may be paralellized to compact concurrently and
then merge the compacted segments (assumption by looking at
psYoungGen.cpp's move_and_update method).

No other clues from me. If I'm missing something obvious (which is
probably the case), then an RTFM with a pointer would be great.

Dawid



More information about the hotspot-gc-dev mailing list