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

Function luaC_fullgc

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

** Performs a full GC cycle; if 'isemergency', set a flag to avoid ** some operations which could change the interpreter state in some ** unexpected ways (running finalizers and shrinking some structures). ** Before running the collection, check 'keepinvariant'; if it is true, ** there may be some objects marked as black, so the collector has ** to sweep all objects to turn them back to white (as

Source from the content-addressed store, hash-verified

1161** changed, nothing will be collected).
1162*/
1163void luaC_fullgc(lua_State *L, int isemergency) {
1164 global_State *g = G(L);
1165 lua_assert(g->gckind == KGC_NORMAL);
1166 if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */
1167 if (keepinvariant(g)) { /* black objects? */
1168 entersweep(L); /* sweep everything to turn them back to white */
1169 }
1170 /* finish any pending sweep phase to start a new cycle */
1171 luaC_runtilstate(L, bitmask(GCSpause));
1172 luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */
1173 luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */
1174 /* estimate must be correct after a full GC cycle */
1175 lua_assert(g->GCestimate == gettotalbytes(g));
1176 luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */
1177 g->gckind = KGC_NORMAL;
1178 setpause(g);
1179}
1180
1181/* }====================================================== */
1182

Callers 2

luaM_realloc_Function · 0.85
lua_gcFunction · 0.85

Calls 3

entersweepFunction · 0.85
luaC_runtilstateFunction · 0.85
setpauseFunction · 0.85

Tested by

no test coverage detected