Avoid starting a GC cycle immediately after library init.

This commit is contained in:
Mike Pall 2010-04-25 19:45:54 +02:00
parent 2ccb24f894
commit f396f3d192
2 changed files with 2 additions and 2 deletions

View File

@ -1147,7 +1147,7 @@ LUA_API int lua_gc(lua_State *L, int what, int data)
g->gc.threshold = LJ_MAX_MEM; g->gc.threshold = LJ_MAX_MEM;
break; break;
case LUA_GCRESTART: case LUA_GCRESTART:
g->gc.threshold = g->gc.total; g->gc.threshold = data == -1 ? (g->gc.total/100)*g->gc.pause : g->gc.total;
break; break;
case LUA_GCCOLLECT: case LUA_GCCOLLECT:
lj_gc_fullgc(L); lj_gc_fullgc(L);

View File

@ -470,7 +470,7 @@ static int pmain(lua_State *L)
LUAJIT_VERSION_SYM(); /* linker-enforced version check */ LUAJIT_VERSION_SYM(); /* linker-enforced version check */
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */ luaL_openlibs(L); /* open libraries */
lua_gc(L, LUA_GCRESTART, 0); lua_gc(L, LUA_GCRESTART, -1);
s->status = handle_luainit(L); s->status = handle_luainit(L);
if (s->status != 0) return 0; if (s->status != 0) return 0;
script = collectargs(argv, &has_i, &has_v, &has_e); script = collectargs(argv, &has_i, &has_v, &has_e);