diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-01-30 11:44:42 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-01-30 11:44:42 -0200 |
commit | 2c32bff60987d38a60a58d4f0123f3783da60a63 (patch) | |
tree | dd97348ac388dd6087c320994bdce6ff18be02e2 /lstate.c | |
parent | 264659bd53e92969a1e17d65c0266597cde24b5d (diff) | |
download | lua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.gz lua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.bz2 lua-2c32bff60987d38a60a58d4f0123f3783da60a63.zip |
After a "bad collections", avoid switching back back to generational
After a major bad collection (one that collects too few objects),
next collection will be major again. In that case, avoid switching
back to generational mode (as it will have to switch again to
incremental to do next major collection).
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -233,7 +233,8 @@ static void init_registry (lua_State *L, global_State *g) { | |||
233 | 233 | ||
234 | /* | 234 | /* |
235 | ** open parts of the state that may cause memory-allocation errors. | 235 | ** open parts of the state that may cause memory-allocation errors. |
236 | ** ('ttisnil(&g->nilvalue)'' flags that the state was completely build) | 236 | ** ('g->nilvalue' being a nil value flags that the state was completely |
237 | ** build.) | ||
237 | */ | 238 | */ |
238 | static void f_luaopen (lua_State *L, void *ud) { | 239 | static void f_luaopen (lua_State *L, void *ud) { |
239 | global_State *g = G(L); | 240 | global_State *g = G(L); |
@@ -386,6 +387,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
386 | g->twups = NULL; | 387 | g->twups = NULL; |
387 | g->totalbytes = sizeof(LG); | 388 | g->totalbytes = sizeof(LG); |
388 | g->GCdebt = 0; | 389 | g->GCdebt = 0; |
390 | g->lastatomic = 0; | ||
389 | setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ | 391 | setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ |
390 | setgcparam(g->gcpause, LUAI_GCPAUSE); | 392 | setgcparam(g->gcpause, LUAI_GCPAUSE); |
391 | setgcparam(g->gcstepmul, LUAI_GCMUL); | 393 | setgcparam(g->gcstepmul, LUAI_GCMUL); |