summaryrefslogtreecommitdiff
path: root/testes/gc.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-26 11:41:02 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-26 11:41:02 -0300
commit1537d6680bb66dc2484e11815bc2cd0e31ca39cc (patch)
treef035f9e28fa2f1a6fba62e1b25d32b8a4b824204 /testes/gc.lua
parente0260eb2d4085723302d637dd8f3fca339d18817 (diff)
downloadlua-github-1537d6680bb66dc2484e11815bc2cd0e31ca39cc.tar.gz
New control for reentrancy of emergency collections
Instead of assuming that shrinking a block may be an emergency collection, use an explicit field ('gcstopem') to stop emergency collections while GC is working.
Diffstat (limited to 'testes/gc.lua')
-rw-r--r--testes/gc.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/testes/gc.lua b/testes/gc.lua
index 80850f92..2332c939 100644
--- a/testes/gc.lua
+++ b/testes/gc.lua
@@ -676,6 +676,14 @@ end
-- just to make sure
assert(collectgarbage'isrunning')
+do -- check that the collector is reentrant in incremental mode
+ setmetatable({}, {__gc = function ()
+ collectgarbage()
+ end})
+ collectgarbage()
+end
+
+
collectgarbage(oldmode)
print('OK')