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

Sure there is for primitive types, for objects the compiler gets to decide what lands on the stack given escape analysis, until Project Panama finally gets integrated.

Additionally both IBM and Azul JVMs do have extensions for stack allocations.



Exactly. Also unlike C++, allocation is nearly free on the JVM, and garbage collection is cheap for short-lived ones.


A nearly free allocation is still more expensive than being able to not allocate at all, and the nearly free allocation will also add to the GC's workload.


Depends pretty much on which GC algorithm is being used.




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

Search: