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 /testes/gc.lua | |
parent | 264659bd53e92969a1e17d65c0266597cde24b5d (diff) | |
download | lua-github-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.gz |
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 'testes/gc.lua')
-rw-r--r-- | testes/gc.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 84e8ffb7..05bf564e 100644 --- a/testes/gc.lua +++ b/testes/gc.lua @@ -11,6 +11,12 @@ collectgarbage() local oldmode = collectgarbage("incremental") +-- changing modes should return previous mode +assert(collectgarbage("generational") == "incremental") +assert(collectgarbage("generational") == "generational") +assert(collectgarbage("incremental") == "generational") +assert(collectgarbage("incremental") == "incremental") + local function gcinfo () return collectgarbage"count" * 1024 |