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/api.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 '')
-rw-r--r-- | testes/api.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/testes/api.lua b/testes/api.lua index c1bcb4b7..bd85a923 100644 --- a/testes/api.lua +++ b/testes/api.lua | |||
@@ -804,15 +804,14 @@ F = function (x) | |||
804 | d = nil | 804 | d = nil |
805 | assert(debug.getmetatable(x).__gc == F) | 805 | assert(debug.getmetatable(x).__gc == F) |
806 | assert(load("table.insert({}, {})"))() -- create more garbage | 806 | assert(load("table.insert({}, {})"))() -- create more garbage |
807 | collectgarbage() -- force a GC during GC | 807 | assert(not collectgarbage()) -- GC during GC (no op) |
808 | assert(debug.getmetatable(x).__gc == F) -- previous GC did not mess this? | ||
809 | local dummy = {} -- create more garbage during GC | 808 | local dummy = {} -- create more garbage during GC |
810 | if A ~= nil then | 809 | if A ~= nil then |
811 | assert(type(A) == "userdata") | 810 | assert(type(A) == "userdata") |
812 | assert(T.udataval(A) == B) | 811 | assert(T.udataval(A) == B) |
813 | debug.getmetatable(A) -- just access it | 812 | debug.getmetatable(A) -- just access it |
814 | end | 813 | end |
815 | A = x -- ressucita userdata | 814 | A = x -- ressurect userdata |
816 | B = udval | 815 | B = udval |
817 | return 1,2,3 | 816 | return 1,2,3 |
818 | end | 817 | end |