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
I am receiving an System.AccessViolationException error when subsetting, then resizing an image. It doesn't happen the first time, but if run it in a loop for several images, it will occur.
Anybody have an idea of a workaround for this issue in the mean time?
Code
SkBitmap bmp = <Load a bitmap of decent size>
var rect = new SKRectI(20, 20, 240, 240);
SKBitmap subset = new SKBitmap(rect.Width, rect.Height, SKImageInfo.PlatformColorType, SKAlphaType.Unpremul);
bmp.ExtractSubset(subset, rect);
int oBMPWidth = bmp.Width* 3;
int oBMPHeight = bmp.Height * 3;
// Scale the bitmap to the new size
SKBitmap ExtractedBitmap = subset.Resize(new SKImageInfo(oBMPWidth, oBMPHeight, SKImageInfo.PlatformColorType, SKAlphaType.Unpremul), SKFilterQuality.High);
Expected Behavior
No response
Actual Behavior
No response
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows 11
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
It doesn't seem to matter which version of SkiaSharp I use. Nor does the error happen consistently. Seems to be more related to the previous issue I created #2456
As somewhat of a workaround I found if I manually dispose and garbage collect after resizing the image it will mostly fix the issue:
subset.Dispose();
subset = null;
GC.Collect();
I say mostly, because the error will not occur now after a few dozen iterations. Instead, I can process about a thousand images before I get an AccessViolation error. So perhaps there is another memory leak somewhere in another portion of the code.
Description
I am receiving an System.AccessViolationException error when subsetting, then resizing an image. It doesn't happen the first time, but if run it in a loop for several images, it will occur.
Anybody have an idea of a workaround for this issue in the mean time?
Code
Expected Behavior
No response
Actual Behavior
No response
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows 11
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: