[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why is the stack cleared on panic?
- From: Julio Merino <jmmv84@...>
- Date: Mon, 10 Jan 2011 21:31:19 +0000
On Mon, Jan 10, 2011 at 8:47 PM, Thomas Harning Jr. <email@example.com> wrote:
> Now, you do need to make sure that you protect your call-sites Lua->C
> so that C++ exceptions don't bubble past Lua as well as Lua errors
> don't bubble past C++ stack mgmt (always pcall).
That's exactly what I am doing. But, in order to prepare the pcall,
you need to push several values onto the stack. Pretty much all the
lua_push* routines can still fail due to out-of-memory conditions.
I.e. my code may end up exiting unexpectedly through the Lua panic
routine regardless of all the efforts gone into the pcall. (That
said, out-of-memory situations are rare and recovering from them is
hard, if not impossible. So I have taken this as a reasonable risk
and assume that this case will never happen.)