Generational behavior for the garbage collector

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

Where is `ffs` defined? I'm getting an implicit declaration compiler warning on windows.