diff options
author | Mike Pall <mike> | 2010-04-25 19:45:54 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-04-25 19:45:54 +0200 |
commit | f396f3d192eb635b3b3a3d074e45e6b810689918 (patch) | |
tree | 4b9d8f3d98f5f5438c2930b2ce034cd874daf860 /src | |
parent | 2ccb24f894bf56873275d8ca42562c0bd6bbc193 (diff) | |
download | luajit-f396f3d192eb635b3b3a3d074e45e6b810689918.tar.gz luajit-f396f3d192eb635b3b3a3d074e45e6b810689918.tar.bz2 luajit-f396f3d192eb635b3b3a3d074e45e6b810689918.zip |
Avoid starting a GC cycle immediately after library init.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_api.c | 2 | ||||
-rw-r--r-- | src/luajit.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index ed4238a9..2b99c267 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -1147,7 +1147,7 @@ LUA_API int lua_gc(lua_State *L, int what, int data) | |||
1147 | g->gc.threshold = LJ_MAX_MEM; | 1147 | g->gc.threshold = LJ_MAX_MEM; |
1148 | break; | 1148 | break; |
1149 | case LUA_GCRESTART: | 1149 | case LUA_GCRESTART: |
1150 | g->gc.threshold = g->gc.total; | 1150 | g->gc.threshold = data == -1 ? (g->gc.total/100)*g->gc.pause : g->gc.total; |
1151 | break; | 1151 | break; |
1152 | case LUA_GCCOLLECT: | 1152 | case LUA_GCCOLLECT: |
1153 | lj_gc_fullgc(L); | 1153 | lj_gc_fullgc(L); |
diff --git a/src/luajit.c b/src/luajit.c index cc2bf710..e8024479 100644 --- a/src/luajit.c +++ b/src/luajit.c | |||
@@ -470,7 +470,7 @@ static int pmain(lua_State *L) | |||
470 | LUAJIT_VERSION_SYM(); /* linker-enforced version check */ | 470 | LUAJIT_VERSION_SYM(); /* linker-enforced version check */ |
471 | lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ | 471 | lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ |
472 | luaL_openlibs(L); /* open libraries */ | 472 | luaL_openlibs(L); /* open libraries */ |
473 | lua_gc(L, LUA_GCRESTART, 0); | 473 | lua_gc(L, LUA_GCRESTART, -1); |
474 | s->status = handle_luainit(L); | 474 | s->status = handle_luainit(L); |
475 | if (s->status != 0) return 0; | 475 | if (s->status != 0) return 0; |
476 | script = collectargs(argv, &has_i, &has_v, &has_e); | 476 | script = collectargs(argv, &has_i, &has_v, &has_e); |