From 2c32bff60987d38a60a58d4f0123f3783da60a63 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Jan 2019 11:44:42 -0200 Subject: 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). --- lstate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index 7f6475a8..6c35ea1a 100644 --- a/lstate.c +++ b/lstate.c @@ -233,7 +233,8 @@ static void init_registry (lua_State *L, global_State *g) { /* ** open parts of the state that may cause memory-allocation errors. -** ('ttisnil(&g->nilvalue)'' flags that the state was completely build) +** ('g->nilvalue' being a nil value flags that the state was completely +** build.) */ static void f_luaopen (lua_State *L, void *ud) { global_State *g = G(L); @@ -386,6 +387,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { g->twups = NULL; g->totalbytes = sizeof(LG); g->GCdebt = 0; + g->lastatomic = 0; setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ setgcparam(g->gcpause, LUAI_GCPAUSE); setgcparam(g->gcstepmul, LUAI_GCMUL); -- cgit v1.2.3-55-g6feb