Skip to content

Releases: microsoft/Microsoft.IO.RecyclableMemoryStream

Microsoft.IO.RecyclableMemoryStream 3.0.0

11 Dec 23:41
2dbbc07
Compare
Choose a tag to compare

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

02 Mar 23:13
44d6a7d
Compare
Choose a tag to compare

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

07 Feb 20:18
55c265b
Compare
Choose a tag to compare

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

26 Aug 21:57
dad7aa3
Compare
Choose a tag to compare

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

06 Oct 20:58
667bec5
Compare
Choose a tag to compare

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

22 Jul 21:50
2e75ee1
Compare
Choose a tag to compare

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

18 Jun 18:26
bbaac7e
Compare
Choose a tag to compare

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

08 Jun 00:03
3695c10
Compare
Choose a tag to compare
  • 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

03 Jun 22:31
a452fef
Compare
Choose a tag to compare
  • 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

Microsoft.IO.RecyclableMemoryStream 2.0.0

18 Mar 17:54
46bbc6d
Compare
Choose a tag to compare

Major new release!

  • Breaking Changes

    • Removed 2 GB stream limit. Extremely large streams can be created by chaining together blocks. Attempts to convert a stream into a contiguous buffer longer than the runtime's limits will result in an exception.
    • Removed build targets for net40, net45, net46, and netstandard1.4. Added net462.
    • Changed some ETW events to provide more information.
    • Refactored .NET events to match the information payloads of the ETW events.
    • GetBuffer now throws OutOfMemoryException instead of InvalidOperationException if the needed size is too large for a contiguous array.
  • Other Changes

    • Removed use of Interlocked methods when checking whether the stream is disposed. This should improve performance. (Concurrent use of streams has never been supported.)
    • RecyclableMemoryStream now implements IBufferWriter<byte>
    • New method overloads of WriteTo that allow you write the contents of the stream directly to another byte[] buffer.
    • Reformatted all code documentation to be more readable.
  • Development-only Changes

    • Significantly improved unit test speed

Nuget: Microsoft.IO.RecyclableMemoryStream 2.0.0