diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-12-13 10:41:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-12-13 10:41:17 -0300 |
commit | 0bfc572e51d9035a615ef6e9523f736c9ffa8e57 (patch) | |
tree | 218f2bb13a873becf8fa657a296c8863f7e0e466 /testes/gc.lua | |
parent | 1de95e97ef65632a88e08b6184bd9d1ceba7ec2f (diff) | |
download | lua-0bfc572e51d9035a615ef6e9523f736c9ffa8e57.tar.gz lua-0bfc572e51d9035a615ef6e9523f736c9ffa8e57.tar.bz2 lua-0bfc572e51d9035a615ef6e9523f736c9ffa8e57.zip |
Bug: GC is not reentrant
As the GC is not reentrant, finalizers should not be able to invoke it.
Diffstat (limited to 'testes/gc.lua')
-rw-r--r-- | testes/gc.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 2332c939..d865cb28 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
@@ -676,11 +676,13 @@ end | |||
676 | -- just to make sure | 676 | -- just to make sure |
677 | assert(collectgarbage'isrunning') | 677 | assert(collectgarbage'isrunning') |
678 | 678 | ||
679 | do -- check that the collector is reentrant in incremental mode | 679 | do -- check that the collector is not reentrant in incremental mode |
680 | local res = true | ||
680 | setmetatable({}, {__gc = function () | 681 | setmetatable({}, {__gc = function () |
681 | collectgarbage() | 682 | res = collectgarbage() |
682 | end}) | 683 | end}) |
683 | collectgarbage() | 684 | collectgarbage() |
685 | assert(not res) | ||
684 | end | 686 | end |
685 | 687 | ||
686 | 688 | ||