When I use the following code on an animation frame, I notice a significant memory leak that eventually causes IOS Safari or Chrome to crash:
ctx.drawImage(anotherCanvas, clipX, clipY, clipW, clipH, x, y, w, h);
Interestingly, if I don't apply any clipping to the canvas and just draw it as is, there is no memory leak.
ctx.drawImage(anotherCanvas, x, y, w, h);
The issue here is that I need to be able to clip the canvas. This problem only occurs on IOS devices. Does anyone have insight into why this might be happening?
Additionally, does anyone know of a reliable workaround to force garbage collection or clear the accumulated memory to prevent crashes?
I would greatly appreciate any assistance or advice. Thank you :)