IT lexicon › Programming › Partial escape analysis

Partial escape analysis

Programming På svenska → Updated: 2026-11-06

Escape analysis done per branch rather than per method: an object that only escapes on a rare path is only allocated on that path.

Ordinary escape analysis gives one yes-or-no answer for the whole method. If an object leaks out through an error path taken once in a million calls, it counts as escaped and lands on the heap every single time. Lukas Stadler, Thomas Würthinger and Hanspeter Mössenböck presented a variant for the Graal compiler in 2014 that keeps the object virtual — loose fields in registers — right up to the point where it actually escapes. Only there is it materialized with a real allocation.

LuaJIT did something similar back in 2012 under the name allocation sinking, with Mike Pall pushing allocations out to the trace side exits that needed them. The gain is largest in code full of small temporaries — iterators, boxed numbers, tuples — that rarely have to exist for real.

← Back to the lexicon