Non-escaping closure memory management

Can somebody provide how non-escaping closures actually work?
I assume that non-escaping uses stack memory.
At least context. I found this prove:

But what about the closure variable? Can somebody help to me. I want to understand how does it work. There is no information about heap/stack allocation in the documentation.

What do you mean by "the closure variable"? Do you mean variables captured by the closure? Or do you mean a variable you assigned the closure to?

If you mean the latter, the compiler enforces that any reference to the closure cannot "escape" in order to be a non-escaping closure. Any variable holding the closure is cleaned up when the scope is done. In theory that means the compiler and optimizer can reason about this to keep the closure on the stack, though I don't know the current state of things and whether this is achieved today.