New mechanism to query GC parameters

This commit is contained in:
Roberto Ierusalimschy
2024-01-16 17:02:55 -03:00
parent 17e0c29d9b
commit 4a8e480864
6 changed files with 35 additions and 27 deletions

View File

@@ -163,15 +163,17 @@ assert(collectgarbage'isrunning')
do print"testing stop-the-world collection"
local step = collectgarbage("setparam", "stepsize", 0);
local step = collectgarbage("param", "stepsize", 0);
collectgarbage("incremental")
assert(collectgarbage("param", "stepsize") == 0)
-- each step does a complete cycle
assert(collectgarbage("step"))
assert(collectgarbage("step"))
-- back to default value
collectgarbage("setparam", "stepsize", step);
collectgarbage("param", "stepsize", step);
assert(collectgarbage("param", "stepsize") == step)
end
collectgarbage(oldmode)