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 | |
parent | 264659bd53e92969a1e17d65c0266597cde24b5d (diff) | |
download | lua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.gz lua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.bz2 lua-2c32bff60987d38a60a58d4f0123f3783da60a63.zip |
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')
-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() | |||
11 | 11 | ||
12 | local oldmode = collectgarbage("incremental") | 12 | local oldmode = collectgarbage("incremental") |
13 | 13 | ||
14 | -- changing modes should return previous mode | ||
15 | assert(collectgarbage("generational") == "incremental") | ||
16 | assert(collectgarbage("generational") == "generational") | ||
17 | assert(collectgarbage("incremental") == "generational") | ||
18 | assert(collectgarbage("incremental") == "incremental") | ||
19 | |||
14 | 20 | ||
15 | local function gcinfo () | 21 | local function gcinfo () |
16 | return collectgarbage"count" * 1024 | 22 | return collectgarbage"count" * 1024 |