▲ | DarkNova6 19 hours ago | |||||||
But stack allocated objects are not part of the heap and therefore not even part of Garbage Collection? And afaik stack allocation is already done for objects which don't escape a method. | ||||||||
▲ | masklinn 7 hours ago | parent [-] | |||||||
Yes, but that’s the point: objects which don’t escape are pretty much all young objects. So by this process the stack captures a significant fraction of the young generation, that young generation never reaches the heap and this is never under consideration by the GC. Essentially the stack is a form of younggen. It is not as complete (as there are things which must be heap allocated) but because it is, it reduces the benefits of a generational GC… without having much impact on its costs and complexity. Depending on work load, that competition can be sufficient to make a generational GC net negative. | ||||||||
|