Brian Goetz: Escape analysis is an optimization that has been talked about for a long time, and it is finally here -- the current builds of Mustang (Java SE 6) can do escape analysis and convert heap allocation to stack allocation (or no allocation) where appropriate. The use of escape analysis to eliminate some allocations results in even faster average allocation times, reduced memory footprint, and fewer cache misses. Further, optimizing away some allocations reduces pressure on the garbage collector and allows collection to run less often.
Escape analysis can find opportunities for stack allocation even where it might not be practical to do so in the source code, even if the language provided the option, because whether a particular allocation gets optimized away is determined based on how the result of an object-returning method is actually used in a particular code path.
The lack of the ability to stack allocate objects has been a complaint against Java from C/C++ programmers for as long as I can remember. C#'s introduction of stack allocated structs forces developers to decide if a class of objects should be stack allocated or heap allocated at class design time, which some think is the wrong time.
Will the entire Java code base see a performance boost because of this optimization? I hope so!