lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Le mar. 11 janv. 2022 à 12:08, Flyer31 Test <flyer31@googlemail.com> a écrit :
>
> Can you give an example how you do this? Do you avoid this "stack
> de-allocate" in Lua code or in C code?
>
> ... just for interest, sorry, I do not really understand what you mean
> by "stack re-allocate" / "stack de-allocate", but it sounds somehow
> interesting possibility... .

It can't be done in Lua, or with the public C API. It would be a
change inside the C implementation of Lua (Francisco was talking about
modifying the VM).

Basically, when growing the stack, instead of doing a realloc() (or
equivalent), simply malloc() a new one, and don't free() the old one
(until the C function is finished).

Julien Cugnière