mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Avoid starting a GC cycle immediately after library init.
This commit is contained in:
parent
2ccb24f894
commit
f396f3d192
@ -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);
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user