-1

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

Destructor
  • 14,123
  • 11
  • 61
  • 126
  • 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
  • 10,545
  • 3
  • 23
  • 40