diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 14:17:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 14:17:28 -0300 |
commit | 9a77f57edc5cc24c2ab71d416b7481a5679e3869 (patch) | |
tree | 5eee1c3da965294d18a599d0b8674f2df402490e /lua.c | |
parent | be908a7d4d8130264ad67c5789169769f824c5d1 (diff) | |
download | lua-9a77f57edc5cc24c2ab71d416b7481a5679e3869.tar.gz lua-9a77f57edc5cc24c2ab71d416b7481a5679e3869.tar.bz2 lua-9a77f57edc5cc24c2ab71d416b7481a5679e3869.zip |
Stop GC while building initial state
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -633,7 +633,8 @@ static int pmain (lua_State *L) { | |||
633 | } | 633 | } |
634 | luaL_openlibs(L); /* open standard libraries */ | 634 | luaL_openlibs(L); /* open standard libraries */ |
635 | createargtable(L, argv, argc, script); /* create table 'arg' */ | 635 | createargtable(L, argv, argc, script); /* create table 'arg' */ |
636 | lua_gc(L, LUA_GCGEN, 0, 0); /* GC in generational mode */ | 636 | lua_gc(L, LUA_GCRESTART); /* start GC... */ |
637 | lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */ | ||
637 | if (!(args & has_E)) { /* no option '-E'? */ | 638 | if (!(args & has_E)) { /* no option '-E'? */ |
638 | if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ | 639 | if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ |
639 | return 0; /* error running LUA_INIT */ | 640 | return 0; /* error running LUA_INIT */ |
@@ -665,6 +666,7 @@ int main (int argc, char **argv) { | |||
665 | l_message(argv[0], "cannot create state: not enough memory"); | 666 | l_message(argv[0], "cannot create state: not enough memory"); |
666 | return EXIT_FAILURE; | 667 | return EXIT_FAILURE; |
667 | } | 668 | } |
669 | lua_gc(L, LUA_GCSTOP); /* stop GC while buidling state */ | ||
668 | lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ | 670 | lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ |
669 | lua_pushinteger(L, argc); /* 1st argument */ | 671 | lua_pushinteger(L, argc); /* 1st argument */ |
670 | lua_pushlightuserdata(L, argv); /* 2nd argument */ | 672 | lua_pushlightuserdata(L, argv); /* 2nd argument */ |