aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2026-01-11 15:36:03 -0300
committerRoberto I <roberto@inf.puc-rio.br>2026-01-11 15:36:03 -0300
commit2a7cf4f319fc276f4554a8f6364e6b1ba4eb2ded (patch)
treea99a8361664b0adda83186f04e2e9c98afd86b44 /lgc.c
parent5cfc725a8b61a6f96c7324f60ac26739315095ba (diff)
downloadlua-2a7cf4f319fc276f4554a8f6364e6b1ba4eb2ded.tar.gz
lua-2a7cf4f319fc276f4554a8f6364e6b1ba4eb2ded.tar.bz2
lua-2a7cf4f319fc276f4554a8f6364e6b1ba4eb2ded.zip
More effort in avoiding errors in finalizersHEADmaster
Before calling a finalizer, Lua not only checks stack limits, but actually ensures that a minimum number of slots are already allocated for the call. (If it cannot ensure that, it postpones the finalizer.) That avoids finalizers not running due to memory errors that the programmer cannot control.
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index f1d9a7ce..0f89451c 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1293,7 +1293,7 @@ static void finishgencycle (lua_State *L, global_State *g) {
1293 correctgraylists(g); 1293 correctgraylists(g);
1294 checkSizes(L, g); 1294 checkSizes(L, g);
1295 g->gcstate = GCSpropagate; /* skip restart */ 1295 g->gcstate = GCSpropagate; /* skip restart */
1296 if (!g->gcemergency && luaD_checkminstack(L)) 1296 if (g->tobefnz != NULL && !g->gcemergency && luaD_checkminstack(L))
1297 callallpendingfinalizers(L); 1297 callallpendingfinalizers(L);
1298} 1298}
1299 1299