MCPcopy Create free account
hub / github.com/DFHack/dfhack / setpause

Function setpause

depends/lua/src/lgc.c:940–949  ·  view source on GitHub ↗

** Set a reasonable "time" to wait before starting a new GC cycle; cycle ** will start when memory use hits threshold. (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

938** less than PAUSEADJ bytes).
939*/
940static void setpause (global_State *g) {
941 l_mem threshold, debt;
942 l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */
943 lua_assert(estimate > 0);
944 threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */
945 ? estimate * g->gcpause /* no overflow */
946 : MAX_LMEM; /* overflow; truncate to maximum */
947 debt = gettotalbytes(g) - threshold;
948 luaE_setdebt(g, debt);
949}
950
951
952/*

Callers 2

luaC_stepFunction · 0.85
luaC_fullgcFunction · 0.85

Calls 1

luaE_setdebtFunction · 0.85

Tested by

no test coverage detected