As we know when object is created it is stored in eden space inside new generation, then moved to survivor spaces (if alive) and subsequently to old generation.
My question is – does major garbage collection clean objects of old generation only or cleans new and old generation both?
There are three types of collection in the HotSpot for Parallel and Concurrent Mark Sweep. There is the minor collection which is just the Eden or the Eden and survivor spaces. A full collection which is everything, and a concurrent collection which is only the old generation. There is no major collection as such. The term full collection is more often used and clearer as to its meaning.
The G1 collector has two generations young and old, but only one collection type and has relatively continuous collections. It might clean just 1 MB or potentially all the memory.
The Azul JVM is purely concurrent in all generations.