We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEBUG
RELEASE
2.1.1
None
Window 11 Pro, Version 10.0.22000 Build 22000
net6.0
When doing a simple image resize the TotalUndisposedAllocationCount increases per image resized.
using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Diagnostics; var photos = Directory.EnumerateFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "*.png", SearchOption.AllDirectories).Take(5); foreach (var photo in photos) { Console.WriteLine($"Number of undisposed ImageSharp buffers: {MemoryDiagnostics.TotalUndisposedAllocationCount}"); using (var outputStream = new MemoryStream()) using (var imageStream = File.OpenRead(photo)) { var (image, format) = await Image.LoadWithFormatAsync(stream: imageStream); image .Mutate(x => x.Resize(image.Width/2, 0, KnownResamplers.Lanczos3)); await image.SaveAsync(outputStream, format); outputStream.Position = 0; Console.WriteLine($"Number of undisposed ImageSharp buffers: {MemoryDiagnostics.TotalUndisposedAllocationCount}"); } }
The text was updated successfully, but these errors were encountered:
You're not disposing of the image in your sample code.
outputStream.Position = 0; + image.Dispose();
Sorry, something went wrong.
No branches or pull requests
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
2.1.1
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Window 11 Pro, Version 10.0.22000 Build 22000
.NET Framework version
net6.0
Description
When doing a simple image resize the TotalUndisposedAllocationCount increases per image resized.
Steps to Reproduce
Images
The text was updated successfully, but these errors were encountered: