4 ms·
> So, why did managed language designers decide to use heap allocation for reference type objects? Because you avoid having to think about where to put the obj
by Guvante 11y ago
> So, why did managed language designers decide to use heap allocation for reference type objects?
Because you avoid having to think about where to put the object while also not eating the cost of copying it if you guess wrong.
The lifetime of a heap object is whatever you define the lifetime to be (which thanks to GC is very flexible) the lifetime of a stack object has an absolute maximum.