Closed ewanhowell5195 closed 2 years ago
If you repeatedly turn the same canvas into a buffer, it gets slower and slower until it crashes with no error message.
This example code below demonstrates this, and crashes after around 2520 iterations.
import {Canvas} from "skia-canvas" const canvas = new Canvas(1, 1) const ctx = canvas.getContext('2d') let i = 1 while(true){ console.time(i) await canvas.png console.timeEnd(i++) }
.png, .jpg, .toBuffer() and .toDataURL() all cause this crash.
.png
.jpg
.toBuffer()
.toDataURL()
The size of the canvas doesn't seem to make a difference to how long it takes to crash.
Please note, creating a new canvas every iteration does not cause this issue. It is only using the same canvas that causes it.
If you repeatedly turn the same canvas into a buffer, it gets slower and slower until it crashes with no error message.
This example code below demonstrates this, and crashes after around 2520 iterations.
.png
,.jpg
,.toBuffer()
and.toDataURL()
all cause this crash.The size of the canvas doesn't seem to make a difference to how long it takes to crash.
Please note, creating a new canvas every iteration does not cause this issue. It is only using the same canvas that causes it.