Hey guys,
I recognized some memory issues at my current project and I was able to reduce the problem to a few lines.
local object = {} function object:createGraphic() local graphic = display.newRect(200,200,11,11) self.graphic = graphic end function object:deleteGraphic() local graphic = self.graphic graphic:removeSelf() graphic=nil self.graphic=nil end
I’m building a tilebased game and every tile is represented by a table which holds all functions and the graphic object.
The tile has functions to create and remove the graphic object, but every time I create and remove the graphic object I got a small memory leak which is climbing up.
It might not be notable with a single tile, but imagine around 1000 tiles creating and removing over and over again, then it becomes a real problem.
So, is there anything wrong with the code above? Am I complitly blind?
I hope you guys could help me out with that.
Greetings
Torben