** Call all finalizers of the objects in the given Lua state, and ** then free all objects, except for the main thread. */
| 1502 | ** then free all objects, except for the main thread. |
| 1503 | */ |
| 1504 | void 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 | |
| 1518 | static lu_mem atomic (lua_State *L) { |
no test coverage detected