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

I've thought about something like this...that if a compiler could tell that code uses only stack-based allocation, it could turn off GC. Of course, that's very limiting, which is why we need more complicated things like Rust's type system to avoid GC.


Java does that, both the HotSpot JIT and the AOT compiler (Substrate VM) I believe will do it. Now it can't always tell that data is local to the stack, but when it can, it won't allocate it on the Heap and will automatically switch to stack allocation (and no GC for it).




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: