Escape Analysis

[h3]Overview[/h3]
Yet another stub – is probably completely wrong

[h3]HotSpot details[/h3]
Like all HotSpot features this can only describe a particular version (JDK8 snapshot on 20140425)

https://wikis.oracle.com/display/HotSpotInternals/EscapeAnalysis

For spot checking of impact escape analysis can be disable by: -XX:-DoEscapeAnalysis

Partial list of situations where HotSpot conservatively assumes a reference escapes:

  • The object requires a finalizer
  • The reference is passed to an invokedynamic call (e.g. lambda and method references)
  • The reference is passed to an instance method where the call isn’t known to be monomorphic (the method can be overridden).
  • The reference is passed through a greater call chain depth than MaxBCEAEstimateLevel
  • The reference is passed to method whos bytecode size is greater than MaxBCEAEstimateSize

Detailed information about escape analysis can be queried with: -XX:+BCEATraceLevel = (1,3)

HotSpot source code:
hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
hotspot/src/share/vm/opto/escape.cpp