It looks like creating a new video inside a gridview:drawCell
method never frees memory from the video. This eventually fills up the entire memory until the simulator or the device crashes. Here’s a video demonstrating the effect.
Here’s an extract from the corresponding code:
function gridview:drawCell(section, row, column, selected, x, y, width, height)
local ctx = playdate.graphics.image.new(width, height, playdate.graphics.kColorBlack)
playdate.graphics.pushContext(ctx)
local video = playdate.graphics.video.new(videoPath)
video:setContext(ctx)
video:renderFrame(0)
video = nil
playdate.graphics.popContext()
ctx:draw(x, y)
end
Attached is a minimum example to reproduce this bug. Memory-Leak.zip (3.0 MB)
Tested with SDK 1.12.2, in the Simulator and on device.
I also mentioned this in the #developer channel in Discord.