Dmitri Shubin wrote: > How can we unwind stack to some safe state and free memory occupied > by this particular lua state? > Can we throw C++ exception, do longjmp() or ? LuaJIT already uses the native exception mechanism (i.e. C++ exceptions) to do the unwinding on x64. But that crashes if there's an intervening JIT-compiled frame. Longjmp might work, but then the LuaJIT VM is no longer in a sane state. The only option would be to print some error and exit the process (without touching the VM anymore). --Mike