I have read that before but still don’t know exactly how a display group is treated.
Are the 2 lines of code below “—IS THIS NEEDED–” necessary to clear the memory? Or this that display group treated like a table and cleared when the function is abandoned?
local function makeit()
local outcast = {} – forward declaration
local outcastGroup = display.newGroup()
local function create_and_abandon()
for i = 1, 10 do
outcast[i] = display.newImage( “image.png” )
outcast[i].x, outcast[i].y = i*20 , i*20
outcastGroup:insert( outcast[i] )
end
end
create_and_abandon()
– we can now remove the object
for i = outcastGroup.numChildren, 1 , -1 do
outcast[i]:removeSelf()
outcast[i] = nil
end
--------IS THIS NEEDED-----------
outcastGroup:removeSelf()
outcastGroup = nil
end