diff options
author | Mike Pall <mike> | 2012-04-11 15:15:50 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-04-11 15:15:50 +0200 |
commit | 44876ec99f3a772e15aa7a8a9b5134356fc6cc16 (patch) | |
tree | 9bfd32e59d8adf0fb2008109de662cf5d7d1e214 | |
parent | e14b6346b4d4f91eb988c8a6046814a8707e04d5 (diff) | |
download | luajit2-44876ec99f3a772e15aa7a8a9b5134356fc6cc16.tar.gz |
Limit number of userdata __gc separations at state close.
-rw-r--r-- | src/lj_state.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lj_state.c b/src/lj_state.c index 711869a2..77c6df67 100644 --- a/src/lj_state.c +++ b/src/lj_state.c @@ -234,6 +234,7 @@ static TValue *cpfinalize(lua_State *L, lua_CFunction dummy, void *ud) LUA_API void lua_close(lua_State *L) { global_State *g = G(L); + int i; L = mainthread(g); /* Only the main thread can be closed. */ lj_func_closeuv(L, tvref(L->stack)); lj_gc_separateudata(g, 1); /* Separate udata which have GC metamethods. */ @@ -242,7 +243,7 @@ LUA_API void lua_close(lua_State *L) G2J(g)->state = LJ_TRACE_IDLE; lj_dispatch_update(g); #endif - for (;;) { + for (i = 0; i < 10; ) { hook_enter(g); L->status = 0; L->cframe = NULL; @@ -251,6 +252,7 @@ LUA_API void lua_close(lua_State *L) lj_gc_separateudata(g, 1); /* Separate udata again. */ if (gcref(g->gc.mmudata) == NULL) /* Until nothing is left to do. */ break; + i++; } } close_state(L); |