| 1114 | |
| 1115 | |
| 1116 | static void generationalcollection (lua_State *L) { |
| 1117 | global_State *g = G(L); |
| 1118 | lua_assert(g->gcstate == GCSpropagate); |
| 1119 | if (g->GCestimate == 0) { /* signal for another major collection? */ |
| 1120 | luaC_fullgc(L, 0); /* perform a full regular collection */ |
| 1121 | g->GCestimate = gettotalbytes(g); /* update control */ |
| 1122 | } |
| 1123 | else { |
| 1124 | lu_mem estimate = g->GCestimate; |
| 1125 | luaC_runtilstate(L, bitmask(GCSpause)); /* run complete (minor) cycle */ |
| 1126 | g->gcstate = GCSpropagate; /* skip restart */ |
| 1127 | if (gettotalbytes(g) > (estimate / 100) * g->gcmajorinc) |
| 1128 | g->GCestimate = 0; /* signal for a major collection */ |
| 1129 | else |
| 1130 | g->GCestimate = estimate; /* keep estimate from last major coll. */ |
| 1131 | |
| 1132 | } |
| 1133 | setpause(g, gettotalbytes(g)); |
| 1134 | lua_assert(g->gcstate == GCSpropagate); |
| 1135 | } |
| 1136 | |
| 1137 | |
| 1138 | static void incstep (lua_State *L) { |
no test coverage detected