summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libs/core/luasrc/debug.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/core/luasrc/debug.lua b/libs/core/luasrc/debug.lua
index d64700e0e1..3969254a95 100644
--- a/libs/core/luasrc/debug.lua
+++ b/libs/core/luasrc/debug.lua
@@ -9,15 +9,19 @@ __file__ = debug.getinfo(1, 'S').source:sub(2)
function trap_memtrace(flags, dest)
flags = flags or "clr"
local tracefile = io.open(dest or "/tmp/memtrace", "w")
+ local peak = 0
local function trap(what, line)
local info = debug.getinfo(2, "Sn")
+ if collectgarbage("count") > peak then
+ peak = collectgarbage("count")
+ end
if tracefile then
tracefile:write(
"[", what, "] ", info.source, ":", (line or "?"), "\t",
(info.namewhat or ""), "\t",
(info.name or ""), "\t",
- collectgarbage("count"), "\n"
+ collectgarbage("count"), " (", peak, ")\n"
)
end
end