Minor GC - when garbage collectors clears objects in the young generation which are not referenced from the "roots". Minor GC works on young heap only. But what if a young object is referenced from the old heap?
-
https://stackoverflow.com/a/47505987/2711488 • https://stackoverflow.com/a/3849058/2711488 – Holger Jul 24 '19 at 17:06
2 Answers
Garbage Collector needs know old objects that refer to young objects. To find all these references, it can scan all old objects but it is very bad solution. So Remembered set keeping this information . Each thread then informs the GC if it changes a reference, which could cause a change in the remember set.
A card table(array of bytes) is a particular type of remembered set. If reference changed, card (Each byte is referred to as a card in card table) gets dirty. Dirty card contain new pointer from the old generation to the young generation. Finally java not scan all old object, instead of scan remembered set.

- 667
- 1
- 4
- 19
-
-
CMS already deleted with JEP-363. I think CMS is not important for this question when you think that the LTS version of java is 17 – Turac Nov 19 '21 at 09:54
Minor GC will collect the young generation but it doesn't mean that the GC will look only at the young generation heap area. The entire heap is considered and a reference from old generation to young generation will mark the object in young generation as alive.
This is described in Minor GC vs Major GC vs Full GC:
During a Minor GC event, Tenured generation is effectively ignored. References from tenured generation to young generation are considered de facto GC roots. References from young generation to Tenured generation are simply ignored during the markup phase.

- 43,645
- 9
- 78
- 111