[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Missing error message in panic handler / calling luaD_throw without error message on stack
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 9 Nov 2014 22:18:35 -0200
> I can make a guess .. pushing an error message is going to require that you allocate heap space for that message.
That is why the error message for memory error is pre-allocated when the state
is created:
http://www.lua.org/source/5.2/lstate.c.html#f_luaopen
http://www.lua.org/source/5.2/lstate.c.html#MEMERRMSG
> We also use a custom allocator (for other reasons), but we reserve a block of heap storage at startup. If an allocation fails, we release that reserved memory to the heap and retry the allocation.
Lua 5.2 implements a emergency gc that is run when memory allocation fails.