MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / setpause

Function setpause

extlibs/lua/src/lgc.c:1357–1368  ·  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

1355** because Lua cannot even start with less than PAUSEADJ bytes).
1356*/
1357static void setpause (global_State *g) {
1358 l_mem threshold, debt;
1359 int pause = getgcparam(g->gcpause);
1360 l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
1361 lua_assert(estimate > 0);
1362 threshold = (pause < MAX_LMEM / estimate) /* overflow? */
1363 ? estimate * pause /* no overflow */
1364 : MAX_LMEM; /* overflow; truncate to maximum */
1365 debt = gettotalbytes(g) - threshold;
1366 if (debt > 0) debt = 0;
1367 luaE_setdebt(g, debt);
1368}
1369
1370
1371/*

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