Hi,
I’ve been investigating various memory leak issues with my code and decided to whittle it down
to a basic example (see below).
It would appear that display.newRect() leaks memory slightly. Is this the case, or am I missing something obvious in the code?
Thanks for any advice offered.
Regards,
Nuimo
local prevMemCount = 0
local function monitorMem()
collectgarbage()
local memCount = collectgarbage("count")
if (prevMemCount ~= memCount) then
print( "MemUsage: " .. memCount)
prevMemCount = memCount
end
end
local k
local rect;
for k = 1, 10000 do
rect = display.newRect(math.random(0, 200), math.random(0,100), 200, 200);
rect:removeSelf();
end
print("end"); monitorMem();
Runtime:addEventListener( "enterFrame", monitorMem )
[import]uid: 87194 topic_id: 23646 reply_id: 323646[/import]