diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-10 20:11:23 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-12-10 20:11:23 -0200 |
| commit | e043b72a55493cde9bb9c19997a4d58bac444630 (patch) | |
| tree | f3ed54ec1dcead65454931ad2a86ebb2a3ea3a15 | |
| parent | a4c35a3269f0581da212b3c4abd04989f88425ce (diff) | |
| download | lua-e043b72a55493cde9bb9c19997a4d58bac444630.tar.gz lua-e043b72a55493cde9bb9c19997a4d58bac444630.tar.bz2 lua-e043b72a55493cde9bb9c19997a4d58bac444630.zip | |
simpler way to collect userdata
| -rw-r--r-- | lgc.h | 2 | ||||
| -rw-r--r-- | lstate.c | 3 |
2 files changed, 3 insertions, 2 deletions
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | void luaC_callallgcTM (lua_State *L); | 18 | void luaC_callallgcTM (lua_State *L); |
| 19 | Udata *luaC_collect (lua_State *L, int all); | 19 | void luaC_collect (lua_State *L, int all); |
| 20 | void luaC_collectgarbage (lua_State *L); | 20 | void luaC_collectgarbage (lua_State *L); |
| 21 | 21 | ||
| 22 | 22 | ||
| @@ -116,7 +116,8 @@ static void close_state (lua_State *L, lua_State *OL) { | |||
| 116 | L->next->previous = L->previous; | 116 | L->next->previous = L->previous; |
| 117 | } | 117 | } |
| 118 | else if (G(L)) { /* last thread; close global state */ | 118 | else if (G(L)) { /* last thread; close global state */ |
| 119 | luaC_callallgcTM(L); /* call GC tag methods for all udata */ | 119 | if (G(L)->rootudata) /* (avoid problems with incomplete states) */ |
| 120 | luaC_callallgcTM(L); /* call GC tag methods for all udata */ | ||
| 120 | luaC_collect(L, 1); /* collect all elements */ | 121 | luaC_collect(L, 1); /* collect all elements */ |
| 121 | lua_assert(G(L)->rootproto == NULL); | 122 | lua_assert(G(L)->rootproto == NULL); |
| 122 | lua_assert(G(L)->rootudata == NULL); | 123 | lua_assert(G(L)->rootudata == NULL); |
