From 1a86d6d57d8bfcbeaff2c00b212545ad4a7da3c9 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 9 Aug 2021 00:00:08 +0200 Subject: [PATCH] try to mitigate 32 bit failures --- tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs | 9 +++++++++ .../TestUtilities/ImageProviders/TestImageProvider.cs | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index bd24e1a8d9..d43c6f0a3f 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -29,6 +29,15 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif { TestImages.Gif.Ratio4x1, 4, 1, PixelResolutionUnit.AspectRatio } }; + public GifEncoderTests() + { + // Free the pool on 32 bit: + if (!TestEnvironment.Is64BitProcess) + { + Configuration.Default.MemoryAllocator.ReleaseRetainedResources(); + } + } + [Theory] [WithTestPatternImages(100, 100, TestPixelTypes, false)] [WithTestPatternImages(100, 100, TestPixelTypes, false)] diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs index 700c40b726..a30cdb4c54 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestImageProvider.cs @@ -21,11 +21,17 @@ namespace SixLabors.ImageSharp.Tests public abstract partial class TestImageProvider : ITestImageProvider, IXunitSerializable where TPixel : unmanaged, IPixel { + public TestImageProvider() + { + this.Configuration = Configuration.CreateDefaultInstance(); + this.Configuration.MemoryAllocator = Configuration.Default.MemoryAllocator; + } + public PixelTypes PixelType { get; private set; } = typeof(TPixel).GetPixelType(); public virtual string SourceFileOrDescription => string.Empty; - public Configuration Configuration { get; set; } = Configuration.CreateDefaultInstance(); + public Configuration Configuration { get; set; } /// /// Gets the utility instance to provide information about the test image & manage input/output.