diff --git a/src/EPPlus/EPPlus/Magicodes.IE.EPPlus.csproj b/src/EPPlus/EPPlus/Magicodes.IE.EPPlus.csproj index 00f4f79a..82337e81 100644 --- a/src/EPPlus/EPPlus/Magicodes.IE.EPPlus.csproj +++ b/src/EPPlus/EPPlus/Magicodes.IE.EPPlus.csproj @@ -53,7 +53,7 @@ - + diff --git a/src/EPPlus/EPPlus/Utils/RecyclableMemoryStream.cs b/src/EPPlus/EPPlus/Utils/RecyclableMemoryStream.cs index 5648b291..56abc822 100644 --- a/src/EPPlus/EPPlus/Utils/RecyclableMemoryStream.cs +++ b/src/EPPlus/EPPlus/Utils/RecyclableMemoryStream.cs @@ -6,18 +6,21 @@ namespace OfficeOpenXml.Utils { public static class RecyclableMemoryStream { - private static readonly Lazy recyclableMemoryStreamManager = new Lazy(); - private static RecyclableMemoryStreamManager RecyclableMemoryStreamManager - { - get - { - var recyclableMemoryStream = recyclableMemoryStreamManager.Value; - recyclableMemoryStream.MaximumFreeSmallPoolBytes = 64 * 1024 * 1024; - recyclableMemoryStream.MaximumFreeLargePoolBytes = 64 * 1024 * 32; - recyclableMemoryStream.AggressiveBufferReturn = true; - return recyclableMemoryStream; - } - } + private static readonly Lazy recyclableMemoryStreamManager = new Lazy(() => + { + var option = new RecyclableMemoryStreamManager.Options(); + option.MaximumSmallPoolFreeBytes = 64 * 1024 * 1024; + option.MaximumLargePoolFreeBytes = 64 * 1024 * 32; + option.AggressiveBufferReturn = true; + return new RecyclableMemoryStreamManager(option); + }); + private static RecyclableMemoryStreamManager RecyclableMemoryStreamManager + { + get + { + return recyclableMemoryStreamManager.Value; + } + } private const string TagSource = "Magicodes.EPPlus"; internal static MemoryStream GetStream()