diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-09 16:35:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-09 16:35:19 -0300 |
commit | fa2f294dd1269115bf9cf534dd38553e2f606801 (patch) | |
tree | dec31b0dfbf6c316c5eee6fc8c0b7f3028598aa9 | |
parent | 82fae58e25b7e2be6390238ce60d5678b24dce44 (diff) | |
download | lua-github-fa2f294dd1269115bf9cf534dd38553e2f606801.tar.gz |
Reduce calls to 'luaC_step' when GC is stopped
-rw-r--r-- | lgc.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1681,12 +1681,15 @@ static void incstep (lua_State *L, global_State *g) { } /* -** performs a basic GC step if collector is running +** Performs a basic GC step if collector is running. (If collector is +** not running, set a reasonable debt to avoid it being called at +** every single check.) */ void luaC_step (lua_State *L) { global_State *g = G(L); - lua_assert(!g->gcemergency); - if (gcrunning(g)) { /* running? */ + if (!gcrunning(g)) /* not running? */ + luaE_setdebt(g, -2000); + else { if(isdecGCmodegen(g)) genstep(L, g); else |