[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: block-scope finalization
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 24 Nov 2015 13:42:46 -0200
> >Someone can trivially hold a reference to the object so that you
> >run out of resources. There is no need to remove __gc.
>
> Even if I provide a custom environment, or `lua_close()` the Lua state?
No :-)
> I have (another) unrelated question:
> After a `lua_pcall(L, 0, LUA_MULTRET, 0)`, does Lua have
> `EXTRA_STACK` stack slots available for its API functions?
No. This is explained in the new release of the manual (5.3.2):
The function results are pushed onto the stack when the function
returns. The number of results is adjusted to nresults, unless
nresults is LUA_MULTRET. In this case, all results from the function
are pushed. Lua takes care that the returned values fit into the
stack space, but it does not ensure any extra space in the stack.
> I.e. if I don't want to call `lua_checkstack()`, do I have to free
> only the stack slots I need myself or the `EXTRA_STACK` stack slots
> for the Lua API as well?
What do you mean by "free the slots"? You never free any slot; only
when the function returns its stack space is reclaimed.
-- Roberto
- References:
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Roberto Ierusalimschy
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Roberto Ierusalimschy
- Re: block-scope finalization, Philipp Janda