Hi All -
Looking to understand memory. I read all the usual docs but I tried this little snippit and nothing is collected. The first sayMem call says 87K. Then I allocate 1000 rect. After that sayMem says 224K. Then I clean up and sayMem says either 224K or even higher depending on how I clean up. The loop that removes should not be needed and obviously doesn’t change the outcome here.
Can anyone tell me why there is no collection here? (I have tried other ways with this snippet and can’t ever get it to work)
Thanks
Ted
[lua]
local sayMem = function()
collectgarbage()
print( "MemUsage: "…collectgarbage(“count”) )
–local textMem = system.getInfo( “textureMemoryUsed” ) / 1000000
–print( "TexMem: " … textMem )
end
sayMem()
local group = display.newGroup()
for i=1,1000 do
group:insert(display.newRect(0,0,i,i))
end
sayMem()
–for i=group.numChildren,1,-1 do
– local r = group[i]
– r:removeSelf()
– --group:remove®
– r = nil
–end
group:removeSelf()
group = nil
sayMem()
[/lua] [import]uid: 73649 topic_id: 36809 reply_id: 336809[/import]