aboutsummaryrefslogtreecommitdiff
path: root/testes/gc.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-12-22 14:48:07 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-12-22 14:48:07 -0300
commite2cc179454c6aa6cde5f98954bd3783e0d5d53a3 (patch)
tree1770fb2eded15ad53211693b19eb2a8698cbf192 /testes/gc.lua
parentad0ea7813b39e76b377983138ca995189e22054f (diff)
downloadlua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.tar.gz
lua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.tar.bz2
lua-e2cc179454c6aa6cde5f98954bd3783e0d5d53a3.zip
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.
Diffstat (limited to 'testes/gc.lua')
-rw-r--r--testes/gc.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/testes/gc.lua b/testes/gc.lua
index d7e0c4ff..61b5da9c 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -27,17 +27,20 @@ end
27 27
28-- test weird parameters to 'collectgarbage' 28-- test weird parameters to 'collectgarbage'
29do 29do
30 collectgarbage("incremental")
31 local opause = collectgarbage("setparam", "pause", 100)
32 local ostepmul = collectgarbage("setparam", "stepmul", 100)
30 local t = {0, 2, 10, 90, 500, 5000, 30000, 0x7ffffffe} 33 local t = {0, 2, 10, 90, 500, 5000, 30000, 0x7ffffffe}
31 for i = 1, #t do 34 for i = 1, #t do
32 local p = t[i] 35 collectgarbage("setparam", "pause", t[i])
33 for j = 1, #t do 36 for j = 1, #t do
34 local m = t[j] 37 collectgarbage("setparam", "stepmul", t[j])
35 collectgarbage("incremental", p, m)
36 collectgarbage("step") 38 collectgarbage("step")
37 end 39 end
38 end 40 end
39 -- restore original parameters 41 -- restore original parameters
40 collectgarbage("incremental", 200, 300) 42 collectgarbage("setparam", "pause", opause)
43 collectgarbage("setparam", "stepmul", ostepmul)
41 collectgarbage() 44 collectgarbage()
42end 45end
43 46