Hello everyone! I’m try to build a simple post-processing unit for my game and witness a memory leak. So now I’m interested: is it a feature or my code is bad:) I’m using a quite primitive way: I’m making a screenshot, then use some fill effects. I’m trying not to make screen captures each frame using a timer instead. It all works fine, but there is a small but constant memory leak, even if fill effects are turned off. If the timer is simply making screenshots, there is a leak as well. Once I turn off this timer, the game is working fine without any memory leaks, so it looks like screen captures filling the memory, but it is strange because I’m trying to clean them up each cycle.
// An endless timer to make screen captures each 50 ms
timer.performWithDelay(50,function()
//Clean previous screenshot
display.remove(Game.UI.ScreenCap)
Game.UI.ScreenCap=nil
//Create a new screenshot
Game.UI.ScreenCap=display.captureBounds(Screen.Bounds,false)
Game.UI.ScreenCap.x,Game.UI.ScreenCap.y=Screen.WidthHalf,Screen.HeightHalf
//Apply some effects here
Game.UI.ScreenCap.fill.effect =...
end,0)