MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / setpause

Function setpause

third-party/lua-5.4.6/src/lgc.c:1059–1070  ·  view source on GitHub ↗

** Set the "time" to wait before starting a new GC cycle; cycle will ** start when memory use hits the threshold of ('estimate' * pause / ** PAUSEADJ). (Division by 'estimate' should be OK: it cannot be zero, ** because Lua cannot even start with less than PAUSEADJ bytes). */

Source from the content-addressed store, hash-verified

1057** because Lua cannot even start with less than PAUSEADJ bytes).
1058*/
1059static void setpause (global_State *g) {
1060 l_mem threshold, debt;
1061 int pause = getgcparam(g->gcpause);
1062 l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
1063 lua_assert(estimate > 0);
1064 threshold = (pause < MAX_LMEM / estimate) /* overflow? */
1065 ? estimate * pause /* no overflow */
1066 : MAX_LMEM; /* overflow; truncate to maximum */
1067 debt = gettotalbytes(g) - threshold;
1068 if (debt > 0) debt = 0;
1069 luaE_setdebt(g, debt);
1070}
1071
1072
1073/*

Callers 4

stepgenfullFunction · 0.70
genstepFunction · 0.70
incstepFunction · 0.70
fullincFunction · 0.70

Calls 1

luaE_setdebtFunction · 0.70

Tested by

no test coverage detected