MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaC_step

Function luaC_step

src/Chain/libraries/glua/lgc.cpp:1133–1151  ·  view source on GitHub ↗

** performs a basic GC step when collector is running */

Source from the content-addressed store, hash-verified

1131** performs a basic GC step when collector is running
1132*/
1133void luaC_step(lua_State *L) {
1134 global_State *g = G(L);
1135 l_mem debt = getdebt(g); /* GC deficit (be paid now) */
1136 if (!g->gcrunning) { /* not running? */
1137 luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */
1138 return;
1139 }
1140 do { /* repeat until pause or enough "credit" (negative debt) */
1141 lu_mem work = singlestep(L); /* perform one single step */
1142 debt -= work;
1143 } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause);
1144 if (g->gcstate == GCSpause)
1145 setpause(g); /* pause until next cycle */
1146 else {
1147 debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */
1148 luaE_setdebt(g, debt);
1149 runafewfinalizers(L);
1150 }
1151}
1152
1153
1154/*

Callers 1

lua_gcFunction · 0.85

Calls 5

getdebtFunction · 0.85
luaE_setdebtFunction · 0.85
singlestepFunction · 0.85
setpauseFunction · 0.85
runafewfinalizersFunction · 0.85

Tested by

no test coverage detected