Generational behavior for the garbage collector

Same as #5227 but living in this repo & squashed.

Could use comments explaining these two counters.