From 6d042a178fba32d10ec23c98fb2fd284397ccddc Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 13 Nov 2023 13:12:33 -0300 Subject: Auxiliary buffer uses external strings The buffer system from the auxiliary library reuses its buffer as external memory when closing long strings. --- testes/gc.lua | 3 --- 1 file changed, 3 deletions(-) (limited to 'testes/gc.lua') diff --git a/testes/gc.lua b/testes/gc.lua index 03093e34..3c928d7c 100644 --- a/testes/gc.lua +++ b/testes/gc.lua @@ -460,10 +460,7 @@ do -- tests for string keys in weak tables a[string.rep("a", 2^22)] = 25 -- long string key -> number value a[string.rep("b", 2^22)] = {} -- long string key -> colectable value a[{}] = 14 -- colectable key - assert(collectgarbage("count") > m + 2^13) -- 2^13 == 2 * 2^22 in KB collectgarbage() - assert(collectgarbage("count") >= m + 2^12 and - collectgarbage("count") < m + 2^13) -- one key was collected local k, v = next(a) -- string key with number value preserved assert(k == string.rep("a", 2^22) and v == 25) assert(next(a, k) == nil) -- everything else cleared -- cgit v1.2.3-55-g6feb