Closed mpaperno closed 1 week ago
Just FYI for others that considered holding off updating, because of this issue - test on your machines. I wasn't able to reproduce the issue on Mac from the gist with async=on, gpu=any. Also we don't have an issue running in production on Windows machines with steady load generating about 17M images/day - we use async and gpu off.
addressed (and hopefully fixed?) in #172
Hello!
I've been tracking down a memory leak with a program I work on which uses skia-canvas. I tracked the issue to s-c and I seem to have narrowed it down to some difference in v1.0.1 vs. 1.0.0.
I've also narrowed down that it only occurs when:
toBuffer('png')
is used (I haven't tested other output formats)toBufferSync('png')
withcanvas.gpu = false
So using async version causes a leak regardless of GPU option, but using the sync version and GPU rendering does not.
More specifically, seems to be caused by 68bef1bdb43f26228090c2858a6dfe74e72eeadf. At the commit prior to that I cannot recreate it (detailed observations below). Why this has anything to do with async operation, I have no idea, but my results were clear and reproducible.
I'm attaching my test script (and a basic package file). It works with skia-canvas versions going back to at leat 0.9.25 and has no other dependencies. Async and GPU (for v1+) can be en/disabled on command line or with variables at the top. The image output is discarded, no files are written... there's a little running time counter to show the script is working. CTRL-C to exit.
Copied from the comments in the test script, here are my observations (memory counts are just for reference, YMMV on various systems of course).
My test system is Windows 10, Intel CPU (no GPU), NVIDIA RTX2080Ti with Studio driver 536.40 (first reported by another user with AMD CPU, NVIDIA RTX3xxx on Win10). Node v18.16.0. I haven't tried it on a system with non-supported GPU yet, but that's on my list.
If anyone else cares to give the test script a shot with the different settings, that'd be great. I spent quite a while verifying my results, but ya never know. It can take a bit of time before the leak is obvious, patience and comparison to "non-leaky" results are helpful.
Please let me know if I can provide any further details.
Thanks! -Max
skia-canvas-mem-test.zip
PS. I also posted the script as a Gist, to see w/out a download. Not much to it. https://gist.github.com/mpaperno/75284be4de0ef2006d876773507e6ddf