3 ms·
In garbage collected languages, are there any objects on the stack? I’m not familiar with GC implementations, but at least theoretically everything is allocated
by Gaelan 7y ago
In garbage collected languages, are there any objects on the stack? I’m not familiar with GC implementations, but at least theoretically everything is allocated on the heap. Maybe some implementations keep things on the stack as an optimization?
- jhomedall 7y agoEscape analysis is a common optimization for GCed languages. e: Also, many languages allow the user create user-defined value types, which are copied rather than referenced. Variables containing these can be stack-allocated.
- pjmlp 7y agoYes, see my reply to other thread. https://news.ycombinator.com/item?id=21335506 https://news.ycombinator.com/item?id=21335506