-1

Why java doesn't allow stack allocated or say local objects? Stack allocated objects are good for runtime efficiency.

Destructor
  • 13,625
  • 9
  • 57
  • 120
  • This design decision is already explained, JIT must handle that, and not the programmer. For more words, try searching the web. – Display Name Jul 11 '14 at 09:54

1 Answers1

3

Java does support it:

http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html#escapeAnalysis

But I don't know how good the analysis is.

pveentjer
  • 9,347
  • 3
  • 20
  • 36