MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / luaC_freeallobjects

Function luaC_freeallobjects

xrepo/packages/l/lua/port/lua/src/lgc.c:1504–1515  ·  view source on GitHub ↗

** Call all finalizers of the objects in the given Lua state, and ** then free all objects, except for the main thread. */

Source from the content-addressed store, hash-verified

1502** then free all objects, except for the main thread.
1503*/
1504void luaC_freeallobjects (lua_State *L) {
1505 global_State *g = G(L);
1506 g->gcstp = GCSTPCLS; /* no extra finalizers after here */
1507 luaC_changemode(L, KGC_INC);
1508 separatetobefnz(g, 1); /* separate all objects with finalizers */
1509 lua_assert(g->finobj == NULL);
1510 callallpendingfinalizers(L);
1511 deletelist(L, g->allgc, obj2gco(g->mainthread));
1512 lua_assert(g->finobj == NULL); /* no new finalizers */
1513 deletelist(L, g->fixedgc, NULL); /* collect fixed objects */
1514 lua_assert(g->strt.nuse == 0);
1515}
1516
1517
1518static lu_mem atomic (lua_State *L) {

Callers 1

close_stateFunction · 0.85

Calls 4

luaC_changemodeFunction · 0.85
separatetobefnzFunction · 0.85
callallpendingfinalizersFunction · 0.85
deletelistFunction · 0.85

Tested by

no test coverage detected