|
@@ -279,6 +279,7 @@ static void close_state (lua_State *L) {
|
|
|
luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
|
|
|
freestack(L);
|
|
|
lua_assert(gettotalbytes(g) == sizeof(LG));
|
|
|
+ lua_assert(g->totalobjs == 1);
|
|
|
(*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */
|
|
|
}
|
|
|
|
|
@@ -387,6 +388,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
|
|
|
g->weak = g->ephemeron = g->allweak = NULL;
|
|
|
g->twups = NULL;
|
|
|
g->totalbytes = sizeof(LG);
|
|
|
+ g->totalobjs = 1;
|
|
|
g->GCdebt = 0;
|
|
|
g->lastatomic = 0;
|
|
|
setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */
|