diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1614,12 +1614,16 @@ static void incstep (lua_State *L, global_State *g) { | |||
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | /* | 1616 | /* |
1617 | ** performs a basic GC step if collector is running | 1617 | ** Performs a basic GC step if collector is running. (If collector is |
1618 | ** not running, set a reasonable debt to avoid it being called at | ||
1619 | ** every single check.) | ||
1618 | */ | 1620 | */ |
1619 | void luaC_step (lua_State *L) { | 1621 | void luaC_step (lua_State *L) { |
1620 | global_State *g = G(L); | 1622 | global_State *g = G(L); |
1621 | lua_assert(!g->gcemergency); | 1623 | lua_assert(!g->gcemergency); |
1622 | if (gcrunning(g)) { /* running? */ | 1624 | if (!gcrunning(g)) /* not running? */ |
1625 | luaE_setdebt(g, -2000); | ||
1626 | else { | ||
1623 | switch (g->gckind) { | 1627 | switch (g->gckind) { |
1624 | case KGC_INC: | 1628 | case KGC_INC: |
1625 | incstep(L, g); | 1629 | incstep(L, g); |