[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua <-> C++ integration with "unused" stack slots
- From: Oliver Schmidt <oschmidt_do_not_send_email_to_this_address@...>
- Date: Fri, 5 Feb 2010 00:15:29 +0100
On Thursday 04 February 2010, Philipp Janda wrote:
> Why are you doing that? You don't get deterministic cleanup of Lua
> values anyway, and IIRC, the stack slots are removed when the function
But if the C++ function does not return soon? If the C++ function does use a
lot of (temporary) C++ objects representing Lua variables (e.g. inside
a C++ loop body) and does call other C++ functions that are also using slots
on the stack, the stack might get full of unused stack slots.
> It does (sort of): Use lua_pushnil + lua_replace instead of lua_remove.
So you mean to set the unused stack slot to nil value? This does not
reduce the stack usage.
Maybe the concept of unused stack slots is not useful in every usage
situations. But it might be useful in cases where one wants to keep
track the stack slot usage through C++ objects.