4 ms·
The purpose of separating into young and old generation is that it's easier to find dead objects in the young generation (as you said, average object lives for
by wonnage 9y ago
The purpose of separating into young and old generation is that it's easier to find dead objects in the young generation (as you said, average object lives for a short period of time). You only have to scan this subset for a minor GC. It doesn't really matter how many long-lived objects you have as long as you can avoid needing to do a major GC.
- openasocket 9y agoDon't you still need to scan the old generation during minor GC, in case a field in one of the older objects was modified to point to an object in the young generation? Or are there optimizations you can use to quickly and efficiently find references from the older generation to the younger?
- bzbarsky 9y ago> in case a field in one of the older objects was modified to point to an object in the young generation? This is typically handled by https://en.wikipedia.org/wiki/Write_barrier#In_Garbage_collection https://en.wikipedia.org/wiki/Write_barrier#In_Garbage_colle...