** Call all finalizers of the objects in the given Lua state, and ** then free all objects, except for the main thread. */
| 1527 | ** then free all objects, except for the main thread. |
| 1528 | */ |
| 1529 | void luaC_freeallobjects (lua_State *L) { |
| 1530 | global_State *g = G(L); |
| 1531 | g->gcstp = GCSTPCLS; /* no extra finalizers after here */ |
| 1532 | luaC_changemode(L, KGC_INC); |
| 1533 | separatetobefnz(g, 1); /* separate all objects with finalizers */ |
| 1534 | lua_assert(g->finobj == NULL); |
| 1535 | callallpendingfinalizers(L); |
| 1536 | deletelist(L, g->allgc, obj2gco(mainthread(g))); |
| 1537 | lua_assert(g->finobj == NULL); /* no new finalizers */ |
| 1538 | deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ |
| 1539 | lua_assert(g->strt.nuse == 0); |
| 1540 | } |
| 1541 | |
| 1542 | |
| 1543 | static void atomic (lua_State *L) { |
no test coverage detected