** Call all finalizers of the objects in the given Lua state, and ** then free all objects, except for the main thread. */
| 1509 | ** then free all objects, except for the main thread. |
| 1510 | */ |
| 1511 | void luaC_freeallobjects (lua_State *L) { |
| 1512 | global_State *g = G(L); |
| 1513 | g->gcstp = GCSTPCLS; /* no extra finalizers after here */ |
| 1514 | luaC_changemode(L, KGC_INC); |
| 1515 | separatetobefnz(g, 1); /* separate all objects with finalizers */ |
| 1516 | lua_assert(g->finobj == NULL); |
| 1517 | callallpendingfinalizers(L); |
| 1518 | deletelist(L, g->allgc, obj2gco(g->mainthread)); |
| 1519 | lua_assert(g->finobj == NULL); /* no new finalizers */ |
| 1520 | deletelist(L, g->fixedgc, NULL); /* collect fixed objects */ |
| 1521 | lua_assert(g->strt.nuse == 0); |
| 1522 | } |
| 1523 | |
| 1524 | |
| 1525 | static lu_mem atomic (lua_State *L) { |
no test coverage detected