aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lstate.c b/lstate.c
index 0c7ca889..11f57728 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.9 2004/06/17 14:06:52 roberto Exp roberto $ 2** $Id: lstate.c,v 2.10 2004/06/17 14:25:31 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -122,9 +122,10 @@ static void preinit_state (lua_State *L, global_State *g) {
122static void close_state (lua_State *L) { 122static void close_state (lua_State *L) {
123 global_State *g = G(L); 123 global_State *g = G(L);
124 luaF_close(L, L->stack); /* close all upvalues for this thread */ 124 luaF_close(L, L->stack); /* close all upvalues for this thread */
125 luaC_sweepall(L); /* collect all elements */ 125 luaC_freeall(L); /* collect all objects */
126 lua_assert(g->rootgc == obj2gco(L)); 126 lua_assert(g->rootgc == NULL);
127 luaS_freeall(L); 127 lua_assert(g->strt.nuse == 0);
128 luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *);
128 luaZ_freebuffer(L, &g->buff); 129 luaZ_freebuffer(L, &g->buff);
129 freestack(L, L); 130 freestack(L, L);
130 lua_assert(g->nblocks == sizeof(LG)); 131 lua_assert(g->nblocks == sizeof(LG));
@@ -177,6 +178,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
177 luaZ_initbuffer(L, &g->buff); 178 luaZ_initbuffer(L, &g->buff);
178 g->panic = NULL; 179 g->panic = NULL;
179 g->gcstate = GCSfinalize; 180 g->gcstate = GCSfinalize;
181 g->gcgenerational = 0;
180 g->rootgc = obj2gco(L); 182 g->rootgc = obj2gco(L);
181 g->sweepstrgc = 0; 183 g->sweepstrgc = 0;
182 g->sweepgc = &g->rootgc; 184 g->sweepgc = &g->rootgc;