diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-01 13:54:29 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-01 13:54:29 -0300 |
| commit | 5276973224066e591b0f1a79c3b091d395848ac4 (patch) | |
| tree | e72f167dca7796b4014b1833cb1e9eaed58a623e /testes/all.lua | |
| parent | f9d857a81b87b695c1e3b34f1e7fe55884d1288f (diff) | |
| download | lua-5276973224066e591b0f1a79c3b091d395848ac4.tar.gz lua-5276973224066e591b0f1a79c3b091d395848ac4.tar.bz2 lua-5276973224066e591b0f1a79c3b091d395848ac4.zip | |
New test module 'tracegc'
New module easies the inclusion of GC tracing in individual test files.
Diffstat (limited to 'testes/all.lua')
| -rw-r--r-- | testes/all.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/testes/all.lua b/testes/all.lua index a4feeec1..a8e44024 100644 --- a/testes/all.lua +++ b/testes/all.lua | |||
| @@ -154,18 +154,8 @@ end | |||
| 154 | 154 | ||
| 155 | dofile('main.lua') | 155 | dofile('main.lua') |
| 156 | 156 | ||
| 157 | do | 157 | -- trace GC cycles |
| 158 | local next, setmetatable, stderr = next, setmetatable, io.stderr | 158 | require"tracegc".start() |
| 159 | -- track collections | ||
| 160 | local mt = {} | ||
| 161 | -- each time a table is collected, remark it for finalization | ||
| 162 | -- on next cycle | ||
| 163 | mt.__gc = function (o) | ||
| 164 | stderr:write'.' -- mark progress | ||
| 165 | local n = setmetatable(o, mt) -- remark it | ||
| 166 | end | ||
| 167 | local n = setmetatable({}, mt) -- create object | ||
| 168 | end | ||
| 169 | 159 | ||
| 170 | report"gc.lua" | 160 | report"gc.lua" |
| 171 | local f = assert(loadfile('gc.lua')) | 161 | local f = assert(loadfile('gc.lua')) |
