MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / setpause

Function setpause

3rd/lua-5.4.3/src/lgc.c:1457–1468  ·  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

1455** because Lua cannot even start with less than PAUSEADJ bytes).
1456*/
1457static void setpause (global_State *g) {
1458 l_mem threshold, debt;
1459 int pause = getgcparam(g->gcpause);
1460 l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
1461 lua_assert(estimate > 0);
1462 threshold = (pause < MAX_LMEM / estimate) /* overflow? */
1463 ? estimate * pause /* no overflow */
1464 : MAX_LMEM; /* overflow; truncate to maximum */
1465 debt = gettotalbytes(g) - threshold;
1466 if (debt > 0) debt = 0;
1467 luaE_setdebt(g, debt);
1468}
1469
1470
1471/*

Callers 4

stepgenfullFunction · 0.85
genstepFunction · 0.85
incstepFunction · 0.85
fullincFunction · 0.85

Calls 1

luaE_setdebtFunction · 0.85

Tested by

no test coverage detected