Is this an SDK bug (1.12.3)?
My Lua project fills the Malloc map and dies if I use a pushContext within another pushContext. I can't let the context stack get higher than one!
This main.lua
shows my problem clearly—I'm not even doing anything with the empty images: pushContext (or lockFocus) alone is enough to crash. (And I'm reusing the same image variables every cycle, as you can see.)
import "CoreLibs/graphics"
local pd <const> = playdate
local gfx <const> = pd.graphics
pd.display.setRefreshRate(10)
local pushContextTest1
local pushContextTest2
function pd.update()
pushContextTest1 = gfx.image.new(1000, 1000, gfx.kColorBlack)
gfx.pushContext(pushContextTest1)
pushContextTest2 = gfx.image.new(1000, 1000, gfx.kColorBlack)
gfx.pushContext(pushContextTest2)
gfx.popContext()
gfx.popContext()
end
The dimensions of the images determine how fast memory fills up. (my project needs 1600x880, but even smaller images will slowly leak.)
Any workarounds?