1
0
Fork 0
forked from len0rd/rockbox

lua -- temp loader

fix a few bugs, improve memory usage

Change-Id: I6ceefd033000a6178eab0dd513679b5d72cec81c
This commit is contained in:
William Wilgus 2021-05-06 10:34:05 -04:00
parent 15ad1c42db
commit adff45ca21
7 changed files with 233 additions and 99 deletions

View file

@ -279,8 +279,9 @@ end
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- reuse table
end
end
tcBase= nil tkSortCbase= nil
if ... then
tcBase= nil tkSortCbase= nil
end
tWriteBuf[#tWriteBuf + 1] = "\r\n"
tWriteBuf[#tWriteBuf + 1] = dtTag("?")
tWriteBuf[#tWriteBuf + 1] = "\r\n\r\n"
@ -309,5 +310,29 @@ end
filehandle:write(table.concat(tWriteBuf))
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- empty table
filehandle:close()
rb.splash(rb.HZ * 5, n .. " Items dumped to : " .. sDumpFile)
--rb.splash((rb.HZ or 100) * 5, n .. " Items dumped to : " .. sDumpFile)
--rb.splash(500, collectgarbage("count"))
if not ... then
local lu = collectgarbage("collect")
local used, allocd, free = rb.mem_stats()
local lu = collectgarbage("count")
local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end
local s_t = {}
s_t[1] = n
s_t[2] = " Items dumped to:\n"
s_t[3] = sDumpFile
s_t[4] = "\n\nLoaded Modules:\n"
n = 0
for k, v in pairsByPairs(tcBase, tkSortCbase ) do
n = n + 1
if n ~= 1 then
s_t[#s_t + 1] = ", "
end
s_t[#s_t + 1] = tostring(k)
if n >= 3 then -- split loaded modules to multiple lines
n = 0
s_t[#s_t + 1] = "\n"
end
end
rb.splash_scroller(5 * (rb.HZ or 100), table.concat(s_t))
end