Small changes around C-stack limit

- Better documentation in 'testes/cstack.lua' about using
'debug.setCstacklimit' to find a good limit.

- Constant LUAI_MAXCSTACK gets added CSTACKERR (extra stack for
error handling), so that it is compatible with the argument to
'debug.setCstacklimit'.
This commit is contained in:
Roberto Ierusalimschy
2019-06-26 13:26:36 -03:00
parent c1a63c45f8
commit 8b7cfee26b
4 changed files with 25 additions and 11 deletions

View File

@@ -388,7 +388,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
preinit_thread(L, g);
g->allgc = obj2gco(L); /* by now, only object is the main thread */
L->next = NULL;
g->Cstacklimit = L->nCcalls = LUAI_MAXCSTACK;
g->Cstacklimit = L->nCcalls = LUAI_MAXCSTACK + CSTACKERR;
g->frealloc = f;
g->ud = ud;
g->warnf = NULL;