aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-11-23 17:17:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-11-23 17:17:20 -0300
commitf356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4 (patch)
treebaa2abdc9bd4707b42c0609da42aa1130757273b /lua.c
parent76953316d1283ab6324b59b914ef53a521408444 (diff)
downloadlua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.tar.gz
lua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.tar.bz2
lua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.zip
First version of GC counting objects for control
Still needs to review generational mode.
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lua.c b/lua.c
index 7f7dc2b2..715430a0 100644
--- a/lua.c
+++ b/lua.c
@@ -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 */