Short answer
Escape analysis is a JIT optimization that determines whether an object's lifetime escapes the method or thread that created it.
Explanation
If an object does not escape, the JIT can allocate it on the stack (or eliminate it entirely via scalar replacement, keeping its fields in registers) instead of the heap, and can remove synchronization on it (lock elision). This reduces heap allocation and GC pressure. It is enabled by default (-XX:+DoEscapeAnalysis); note it is not a guarantee — it depends on the JIT actually compiling and proving non-escape.
Common mistakes
- Saying escape analysis allocates objects on the stack literally.
- Not mentioning scalar replacement and lock elision.