Three points:<p>1. There are many other things that can cause escape analysis to fail. You can also capture references to a value in an opaque function, send it over a channel, etc. etc.<p>2. There is no <i>semantic</i> difference between stack and heap (modulo when finalizers run). The only thing the language says is that object is guaranteed to be destroyed when it is no longer referenced. The compiler can fulfill this obligation sometimes through stack obligations, but that&#x27;s done through a set of heuristics. The <i>language</i> says nothing about this (and the FAQ states this quite explicitly).<p>3. Java does the same thing. The HotSpot JVM will use escape analysis to perform SROA (which is an important optimization). Note that escape analysis is <i>independent</i> of value vs. reference types; Java has much fewer value types, but it can <i>still</i> do escape analysis. This is because value&#x2F;reference and stack&#x2F;heap are orthogonal.