Hi everyone.
Fighting memory leaks in my game I found one strange thing:
Corona itself allocates about 10…20 kb every second.
10 kb in case of empty project (only main.lua)
20 kb, if config.lua is also present (with fps = 60)
Proof:
main.lua:
[lua]local t = {}
t.showMemoryUsage = function()
local textureMem = system.getInfo(“textureMemoryUsed”)
local mem = collectgarbage(“count”)
print(“Texture mem: " … (textureMem / 1000) … " kb;\tmem: " … mem … " kb”)
end
t.startMemoryTracking = function(period, forceCollect)
t.memTrackTimer = timer.performWithDelay(period, function()
if (forceCollect) then
collectgarbage(“collect”)
end
t.showMemoryUsage()
end, -1)
end
collectgarbage(“stop”)
t.startMemoryTracking(5000, false)
[/lua]
You can change period from 5000 and play with ‘forceCollect’ to see that there are really 20 kb. Yes, they are cleaned up by gc, but that’s not good anyway.
Can someone from Corona stuff explain this? [import]uid: 203645 topic_id: 36401 reply_id: 336401[/import]