New option "setparms" for 'collectgarbage'

The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
This commit is contained in:
Roberto Ierusalimschy
2023-12-22 14:48:07 -03:00
parent ad0ea7813b
commit e2cc179454
13 changed files with 163 additions and 78 deletions

View File

@@ -365,12 +365,12 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned int seed) {
g->marked = 0;
g->GCdebt = 0;
setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */
setgcparam(g, gcppause, LUAI_GCPAUSE);
setgcparam(g, gcpstepmul, LUAI_GCMUL);
setgcparam(g, gcpstepsize, LUAI_GCSTEPSIZE);
setgcparam(g, gcpgenminormul, LUAI_GENMINORMUL);
setgcparam(g, gcpminormajor, LUAI_MINORMAJOR);
setgcparam(g, gcpmajorminor, LUAI_MAJORMINOR);
setgcparam(g, PAUSE, LUAI_GCPAUSE);
setgcparam(g, STEPMUL, LUAI_GCMUL);
setgcparam(g, STEPSIZE, LUAI_GCSTEPSIZE);
setgcparam(g, MINORMUL, LUAI_GENMINORMUL);
setgcparam(g, MINORMAJOR, LUAI_MINORMAJOR);
setgcparam(g, MAJORMINOR, LUAI_MAJORMINOR);
for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
/* memory allocation error: free partial state */