You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Skia] BitmapCreateOptions.IgnoreImageCache still adds the load to the static bitmap cache #25098
On Skia heads, a BitmapImage with CreateOptions="IgnoreImageCache" skips the lookup in the static _bitmapImageCache, but its load task is still added to that cache. The decoded image is therefore retained by the cache for as long as it takes 100 newer images to evict it, exactly as if the option were not set.
Decompiled from Uno.WinUI 6.8.0-dev.212 (uno-runtime/net10.0/skia/Uno.UI.dll, BitmapImage.TryOpenSourceAsync):
boolignoreCache=CreateOptions.HasFlag(BitmapCreateOptions.IgnoreImageCache);varcacheKey=newBitmapImageCacheKey(uri,decodeWidth,decodeHeight);if(ignoreCache||!_bitmapImageCache.TryGetValue(cacheKey,outvartask)){task=Task.Run(...);if(FeatureConfiguration.Image.EnableBitmapImageCache)// <- not gated on ignoreCache{_bitmapImageCache.Add(cacheKey,task);ct.Register(()=>_bitmapImageCache.Remove(cacheKey));}}
The same shape is in src/Uno.UI/UI/Xaml/Media/Imaging/BitmapImage.cs on master.
Why it matters
The cache is bounded by entry count (FeatureConfiguration.Image.MaxBitmapImageCacheCount, default 100), not by bytes. A full-size image decodes to width × height × 4 bytes; on WebAssembly the browser-decoded pixel array is additionally wrapped with SKImage.FromPixels and pinned (ImageSourceHelpers.ReadFromStreamAsCompositionSurface), so each cached 4000×2667 image holds ~40 MB of pinned managed memory. A document viewer that shows a few dozen such images pins over a gigabyte that no element owns, and on WebAssembly that reaches the 2 GB linear memory limit and terminates the runtime. IgnoreImageCache is the documented way to keep such images out of the cache, and it has no effect.
Expected behavior
IgnoreImageCache should neither read from nor write to the cache, so the decoded image lives only as long as the BitmapImage that produced it.
Activity
fix(imaging): Don't cache IgnoreImageCache loads
fix(imaging): Don't cache IgnoreImageCache loads
fix(imaging): Don't cache IgnoreImageCache loads