Skip to content

Releases: microsoft/Microsoft.IO.RecyclableMemoryStream

Microsoft.IO.RecyclableMemoryStream 3.0.1

Choose a tag to compare

@benmwatson benmwatson released this 11 Jun 21:10

Bug Fix

Fix infinite loop bug when calling (Try)GetBuffer on a stream longer than 1 GB when using the UseExponentialLargeBuffer option. (Issue #344)

NuGet: Microsoft.IO.RecyclableMemoryStream 3.0.1

Microsoft.IO.RecyclableMemoryStream 3.0.0

Choose a tag to compare

@benmwatson benmwatson released this 11 Dec 23:41
2dbbc07

Breaking Changes

  • Removed int-based constructor and GetStream overloads where long-based methods exist.
  • Removed all methods marked with [Obsolete]:
    • StreamDisposedEventArgs.ctor(Guid, string, string, string)
    • RecyclableMemoryStreamManager.GetStream(Guid, string, Memory<byte>)
    • RecyclableMemoryStreamManager.GetStream(Memory<byte>)
    • RecyclableMemoryStreamManager.GetStream(string, Memory<byte>)
  • Enable nullable annotations and warnings. i.e., added <Nullable>enabled</Nullable> to the project file.
  • All overloads of RecyclableMemoryStreamManager.GetStream now return type RecyclableMemoryStream instead of MemoryStream.
  • Removed explicit targets for net462, netcoreapp2.1, and net5.0. Supported targets are netstandard2.0, netstandard2.1, and net6.0 (there are a few net6.0-specific optimizations).
  • Moved all the configuration settings for RecyclableMemoryStreamManager to the new RecyclableMemoryStreamManager.Options class. Removed many of the constructors as a result. This class will facilitate easier dependency injection through use of the Options pattern, for those who need it.
  • Renamed some settings' names to be more consistent (e.g., MaximumLargePoolFreeBytes)

New Features

  • Added a new option for RecyclableMemoryStreamManager: ZeroOutBuffer, which will cause all buffers to be cleared on allocation and when returning to the pool. Off by default.

Other Changes

  • Upgrade NUnit test library to version 4.
  • Fix some spelling issues in comments and variable names.
  • Update code to the latest recommended C# syntax.

NuGet: Microsoft.IO.RecyclableMemoryStream 3.0.0

Microsoft.IO.RecyclableMemoryStream 2.3.2

Choose a tag to compare

@benmwatson benmwatson released this 02 Mar 23:13
44d6a7d

Optimizations:

  • Calculating blocks and offsets was made more efficient by using Math.DivRem.
  • Reading and writing to the stream was made more efficient with fewer array accesses.
  • CopyTo was overridden to avoid using the slower default implementation.

NuGet: Microsoft.IO.RecyclableMemoryStream 2.3.2

Microsoft.IO.RecyclableMemoryStream 2.3.1

Choose a tag to compare

@benmwatson benmwatson released this 07 Feb 20:18
55c265b

New Feature:

  • Stream lifetime (creation through dispose) is now tracked and reported through the MemoryStreamDispose EventSource event, as well as through the StreamDisposed .NET event.

Changes:

  • The pool statistics used to be reported only when blocks/buffers were returned to the pool. This could lead to lopsided reporting patterns in some cases. Now, pool statistics are reported on stream creation and disposal.
  • Added pool stats information to the MemoryStreamDiscardBuffer event.
  • Changed events relating to buffer creation to be at the warning level instead of verbose. These are signals that the pool might not be large enough to handle the load.

Bug Fixes:

  • Fixed allocation/finalization bug that could cause a NullReferenceException in some low-memory scenarios.

Internal:

  • .NET 7 SDK used to build
  • Changed coding style to match some newer patterns (and added .editorconfig file to enforce in the future)
  • Fixed punctuation and spelling in API documentation.

NuGet: Microsoft.IO.RecyclableMemoryStream 2.3.1

Microsoft.IO.RecyclableMemoryStream 2.2.1

Choose a tag to compare

@benmwatson benmwatson released this 26 Aug 21:57
dad7aa3

API change:

  • There are now overloads that take a type long parameter for requestedSize.

Bug Fix:

  • ToString will no longer throw an exception if the stream is disposed.

NuGet: Microsoft.IO.RecyclableMemoryStream 2.2.1

Microsoft.IO.RecyclableMemoryStream 2.2.0

Choose a tag to compare

@benmwatson benmwatson released this 06 Oct 20:58
667bec5

API changes:

  • Add an override for GetStream that takes a ReadOnlySpan<byte>. This supercedes the versions of GetStream that take Memory<byte>, which were marked as [Obsolete].

Bug Fixes:

  • Fixed: GetReadOnlySequence() throws ArgumentOutOfRangeException

Performance Improvements:

  • Removed enumerator allocation when returning blocks to the pool.
  • Changed default size of stream's block list to 0 because EnsureCapacity will always run, potentially resizing the list anyway.
  • Removed unneeded closure allocation when copying buffers.
  • Use GC.AllocateUninitializedArray in an additional spot, for better performance in .NET 5+.

Documentation:

  • Improved documentation, standardized puncutation, fixed code formatting.

NuGet: Microsoft.IO.RecyclableMemoryStream 2.2.0

Microsoft.IO.RecyclableMemoryStream 2.1.3

Choose a tag to compare

@benmwatson benmwatson released this 22 Jul 21:50
2e75ee1

Fixed another integer overrun math bug related to the new 64-bit data sizes that handle longer streams. The tests have also been updated to check for more issues like this.

NuGet: Microsoft.IO.RecyclableMemoryStream 2.1.3

Microsoft.IO.RecyclableMemoryStream 2.1.2

Choose a tag to compare

@benmwatson benmwatson released this 18 Jun 18:26
bbaac7e

Changes:

  • Fixed an integer overflow bug when buffer sizes are near Int32.MaximumValue

NuGet: Microsoft.IO.RecyclableMemoryStream 2.1.2

Microsoft.IO.RecyclableMemoryStream 2.1.1

Choose a tag to compare

@benmwatson benmwatson released this 08 Jun 00:03
3695c10
  • Fixed a bug introduced in 2.1.0 related to security inheritance rules

NuGet: Microsoft.IO.RecyclableMemoryStream 2.1.1

Microsoft.IO.RecyclableMemoryStream 2.1.0

Choose a tag to compare

@benmwatson benmwatson released this 03 Jun 22:31
a452fef
  • Added RecyclableMemoryStreamManager constructor overloads that take parameters for specifying the maximum free pool sizes. Updated IntelliSense documentation to make clear that these values need to be explciitly set to avoid unbounded pool growth.
  • Buffers are now allocated using GC.AllocateUninitializedArray in .NET 5.
  • net462 and netstandard2.0 targets can now support the Span-related APIs via a dependency on System.Memory.
  • Updated documentation to fix typos and clarify language in some parts.
  • Support for Source Link

NuGet: Microsoft.IO.RecyclableMemoryStream 2.1.0