summaryrefslogtreecommitdiff
path: root/source/luametatex/source/luacore/lua54/src/lgc.c
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2023-01-26 19:34:21 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2023-01-26 19:34:21 +0100
commit83667a906d7cac842635bc5243db70f55b346562 (patch)
tree6d22734798c775c081c3aecb7f05faf590e6570b /source/luametatex/source/luacore/lua54/src/lgc.c
parentb47e8c2cdeeab0bcdb1c4c32328c933f3f8599de (diff)
downloadcontext-83667a906d7cac842635bc5243db70f55b346562.tar.gz
2023-01-26 18:34:00
Diffstat (limited to 'source/luametatex/source/luacore/lua54/src/lgc.c')
-rw-r--r--source/luametatex/source/luacore/lua54/src/lgc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/luametatex/source/luacore/lua54/src/lgc.c b/source/luametatex/source/luacore/lua54/src/lgc.c
index 2e7499025..a3094ff57 100644
--- a/source/luametatex/source/luacore/lua54/src/lgc.c
+++ b/source/luametatex/source/luacore/lua54/src/lgc.c
@@ -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