3 ms·
The generational hypothesis works best when most memory allocations over time are rooted by call stacks that sooner or later return to a core loop. Start rootin
by barrkel 8y ago
The generational hypothesis works best when most memory allocations over time are rooted by call stacks that sooner or later return to a core loop. Start rooting things in long-lived stack frames, or in static things like a cache, and things get worse.
Whether the language uses value types or heap allocated types changes the constant factor, but the core hypothesis isn't affected - you can't allocate everything on the stack. Memory copying costs start overtaking GC overhead if you try too hard.