Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?


Yes, see my reply to other thread.

https://news.ycombinator.com/item?id=21335506


Escape 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: