aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
Diffstat (limited to 'testes')
-rw-r--r--testes/gc.lua42
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
169end 168end
170 169
171 170
172--
173-- test the "size" of basic GC steps (whatever they mean...)
174--
175do
176print("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
208end
209
210
211if not _port then 171if not _port then
212 -- test the pace of the collector 172 -- test the pace of the collector
213 collectgarbage(); collectgarbage() 173 collectgarbage(); collectgarbage()