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

Function stepgenfull

3rd/lua-5.4.3/src/lgc.c:1374–1392  ·  view source on GitHub ↗

** Does a major collection after last collection was a "bad collection". ** ** When the program is building a big structure, it allocates lots of ** memory but generates very little garbage. In those scenarios, ** the generational mode just wastes time doing small collections, and ** major collections are frequently what we call a "bad collection", a ** collection that frees too few objects. To av

Source from the content-addressed store, hash-verified

1372** ('g->lastatomic != 0' also means that the last collection was bad.)
1373*/
1374static void stepgenfull (lua_State *L, global_State *g) {
1375 lu_mem newatomic; /* count of traversed objects */
1376 lu_mem lastatomic = g->lastatomic; /* count from last collection */
1377 if (g->gckind == KGC_GEN) /* still in generational mode? */
1378 enterinc(g); /* enter incremental mode */
1379 luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */
1380 newatomic = atomic(L); /* mark everybody */
1381 if (newatomic < lastatomic + (lastatomic >> 3)) { /* good collection? */
1382 atomic2gen(L, g); /* return to generational mode */
1383 setminordebt(g);
1384 }
1385 else { /* another bad collection; stay in incremental mode */
1386 g->GCestimate = gettotalbytes(g); /* first estimate */;
1387 entersweep(L);
1388 luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */
1389 setpause(g);
1390 g->lastatomic = newatomic;
1391 }
1392}
1393
1394
1395/*

Callers 1

genstepFunction · 0.85

Calls 7

enterincFunction · 0.85
luaC_runtilstateFunction · 0.85
atomicFunction · 0.85
atomic2genFunction · 0.85
setminordebtFunction · 0.85
entersweepFunction · 0.85
setpauseFunction · 0.85

Tested by

no test coverage detected