Demo link:
https://jsfiddle.net/5c7dwszt/5/I have a demo, where I create a buch of images on button "Make images", in the console there are logs for each texture creation, I create 1000 images using this code
const surf = canvas.makeSurface({
width: 500,
height: 500,
alphaType: CanvasKit.AlphaType.Premul,
colorSpace: CanvasKit.ColorSpace.SRGB,
colorType: CanvasKit.ColorType.RGBA_8888,
});
surf.flush();
const image = surf.makeImageSnapshot();
setTimeout(() => {
image.delete();
}, 10);
surf.delete();
I delete each surface as well as each image, so I expect that such code would use memory only during execution, but my expirements say the opposite:
When I click "Make images" my OS memory profiler shows memory increase, then memory decreases, but not to the same level as it was in the beginning. Also, my logs for texture creation/deletion say that there are 268 textures left undeleted. When I trigger releaseResourcesAndAbandonContext it frees the rest of the textures.
So my question is does skia have some kind of cache of images? Even though I cant imagine how to use such a cache.
It is very critical for me, because in my example these 268 textures use about 300mb of memory (according to my memoty profiler).