ИМХО отказываться от CE Lua скриптов из-за утечек памяти не стоит.
Можно чистить память следующим образом
function startCollectgarbageProcess(interval, showStatus)
local timer1 = createTimer(true)
timer1.Interval = interval
timer1.onTimer = function ()
if (showStatus) then
print(string.format('Lua memory usage %.1f MiB',collectgarbage('count')/1024))
end
collectgarbage("restart")
collectgarbage("collect")
if (showStatus) then
print(string.format('Lua memory usage %.1f MiB',collectgarbage('count')/1024))
end
end
end
-- Собирать каждую 1 минуту и показать результат
startCollectgarbageProcess(60000, true)