diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-01 16:38:28 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-01 16:38:28 -0300 |
| commit | b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3 (patch) | |
| tree | 99d83abfb2da27d30498f87b9e6b159e73d99812 /testes | |
| parent | 35a2fed2d1e0b95a1bfab364707e469863517085 (diff) | |
| download | lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.tar.gz lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.tar.bz2 lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.zip | |
Removed parameter in 'collectgarbage("step")'
A call to 'collectgarbage("step")' always performs one GC basic step.
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/gc.lua | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/testes/gc.lua b/testes/gc.lua index 4cf7d556..d7e0c4ff 100644 --- a/testes/gc.lua +++ b/testes/gc.lua | |||
| @@ -33,8 +33,7 @@ do | |||
| 33 | for j = 1, #t do | 33 | for j = 1, #t do |
| 34 | local m = t[j] | 34 | local m = t[j] |
| 35 | collectgarbage("incremental", p, m) | 35 | collectgarbage("incremental", p, m) |
| 36 | collectgarbage("step", 0) | 36 | collectgarbage("step") |
| 37 | collectgarbage("step", 10000) | ||
| 38 | end | 37 | end |
| 39 | end | 38 | end |
| 40 | -- restore original parameters | 39 | -- restore original parameters |
| @@ -169,45 +168,6 @@ do | |||
| 169 | end | 168 | end |
| 170 | 169 | ||
| 171 | 170 | ||
| 172 | -- | ||
| 173 | -- test the "size" of basic GC steps (whatever they mean...) | ||
| 174 | -- | ||
| 175 | do | ||
| 176 | print("steps") | ||
| 177 | |||
| 178 | print("steps (2)") | ||
| 179 | |||
| 180 | local function dosteps (siz) | ||
| 181 | collectgarbage() | ||
| 182 | local a = {} | ||
| 183 | for i=1,100 do a[i] = {{}}; local b = {} end | ||
| 184 | local x = gcinfo() | ||
| 185 | local i = 0 | ||
| 186 | repeat -- do steps until it completes a collection cycle | ||
| 187 | i = i+1 | ||
| 188 | until collectgarbage("step", siz) | ||
| 189 | assert(gcinfo() < x) | ||
| 190 | return i -- number of steps | ||
| 191 | end | ||
| 192 | |||
| 193 | collectgarbage"stop" | ||
| 194 | |||
| 195 | if not _port then | ||
| 196 | assert(dosteps(10) < dosteps(2)) | ||
| 197 | end | ||
| 198 | |||
| 199 | -- collector should do a full collection with so many steps | ||
| 200 | assert(dosteps(20000) == 1) | ||
| 201 | assert(collectgarbage("step", 20000) == true) | ||
| 202 | assert(collectgarbage("step", 20000) == true) | ||
| 203 | |||
| 204 | assert(not collectgarbage("isrunning")) | ||
| 205 | collectgarbage"restart" | ||
| 206 | assert(collectgarbage("isrunning")) | ||
| 207 | |||
| 208 | end | ||
| 209 | |||
| 210 | |||
| 211 | if not _port then | 171 | if not _port then |
| 212 | -- test the pace of the collector | 172 | -- test the pace of the collector |
| 213 | collectgarbage(); collectgarbage() | 173 | collectgarbage(); collectgarbage() |
