From 2c32bff60987d38a60a58d4f0123f3783da60a63 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Jan 2019 11:44:42 -0200 Subject: 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). --- testes/gc.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'testes') 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 -- cgit v1.2.3-55-g6feb