From ed9be5e1f0d4b68aa848f85744ad959d7a57c9f4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 11 Dec 2001 14:52:57 -0200 Subject: reentrant implementation of garbage collection --- lstate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index 35518cbc..6f66df93 100644 --- a/lstate.c +++ b/lstate.c @@ -59,8 +59,9 @@ static void f_luaopen (lua_State *L, void *ud) { G(L)->rootproto = NULL; G(L)->rootcl = NULL; G(L)->roottable = NULL; - G(L)->rootudata = NULL; G(L)->rootupval = NULL; + G(L)->rootudata = NULL; + G(L)->tmudata = NULL; G(L)->nblocks = sizeof(lua_State) + sizeof(global_State); luaD_init(L, so->stacksize); /* init stack */ /* create default event table with a dummy table, and then close the loop */ @@ -118,6 +119,7 @@ static void close_state (lua_State *L, lua_State *OL) { else if (G(L)) { /* last thread; close global state */ if (G(L)->rootudata) /* (avoid problems with incomplete states) */ luaC_callallgcTM(L); /* call GC tag methods for all udata */ + lua_assert(G(L)->tmudata == NULL); luaC_collect(L, 1); /* collect all elements */ lua_assert(G(L)->rootproto == NULL); lua_assert(G(L)->rootudata == NULL); -- cgit v1.2.3-55-g6feb