NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
NuGet · #140 most downloaded on NuGet
A pooled MemoryStream allocator to decrease GC load and improve performance on highly scalable systems.
Last release 1 months ago
10 Aug 2026
Release timing varies
gaps range from 2 weeks to 2.1 years
Most releases are documented
notes for 19 of 24 stable releases
2 versions withdrawn
withdrawn after publishing
127 years old
28 releases · first in 1900
Nothing published for this version
Nothing published for this version
Fix infinite loop bug when calling (Try)GetBuffer on a stream longer than 1 GB when using the UseExponentialLargeBuffer option. (Issue #344 )
Bug Fix
Fix infinite loop bug when calling (Try)GetBuffer on a stream longer than 1 GB when using the UseExponentialLargeBuffer option. (Issue #344)
One column per quarter.
Removed int -based constructor and GetStream overloads where long -based methods exist.
Breaking Changes
int-based constructor and GetStream overloads where long-based methods exist.[Obsolete]:
StreamDisposedEventArgs.ctor(Guid, string, string, string)RecyclableMemoryStreamManager.GetStream(Guid, string, Memory<byte>)RecyclableMemoryStreamManager.GetStream(Memory<byte>)RecyclableMemoryStreamManager.GetStream(string, Memory<byte>)<Nullable>enabled</Nullable> to the project file.RecyclableMemoryStreamManager.GetStream now return type RecyclableMemoryStream instead of MemoryStream.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.MaximumLargePoolFreeBytes)New Features
RecyclableMemoryStreamManager: ZeroOutBuffer, which will cause all buffers to be cleared on allocation and when returning to the pool. Off by default.Other Changes
Calculating blocks and offsets was made more efficient by using Math.DivRem .
Optimizations:
Math.DivRem.CopyTo was overridden to avoid using the slower default implementation.Stream lifetime (creation through dispose) is now tracked and reported through the MemoryStreamDispose EventSource event, as well as through the Strea
New Feature:
MemoryStreamDispose EventSource event, as well as through the StreamDisposed .NET event.Changes:
MemoryStreamDiscardBuffer event.Bug Fixes:
NullReferenceException in some low-memory scenarios.Internal:
Co-authored-by: Ben Watson bewatson@microsoft.com
Co-authored-by: Ben Watson bewatson@microsoft.com
There are now overloads that take a type long parameter for requestedSize.
API change:
long parameter for requestedSize.Bug Fix:
ToString will no longer throw an exception if the stream is disposed.Additional framework targets, better .Net Core support, simplified build.
Additional framework targets, better .Net Core support, simplified build.
API changes:
GetStream that takes a ReadOnlySpan<byte>. This supercedes the versions of GetStream that take Memory<byte>, which were marked as [Obsolete].Bug Fixes:
GetReadOnlySequence() throws ArgumentOutOfRangeExceptionPerformance Improvements:
EnsureCapacity will always run, potentially resizing the list anyway.GC.AllocateUninitializedArray in an additional spot, for better performance in .NET 5+.Documentation:
API changes
GetStream that takes a ReadOnlySpan<byte>. This supersedes the versions of GetStream that take Memory<byte>, which were marked as [Obsolete].Bug Fixes
GetReadOnlySequence() throws ArgumentOutOfRangeExceptionPerformance Improvements
EnsureCapacity will always run, potentially resizing the list anyway.GC.AllocateUninitializedArray in an additional spot, for better performance in .NET 5+.Documentation
Additional framework targets, better .Net Core support, simplified build.
Additional framework targets, better .Net Core support, simplified build.
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.
** Bug Fixes**
Fixed an integer overflow bug when buffer sizes are near Int32.MaximumValue
Changes:
Int32.MaximumValueBug Fixes
[SecurityRules(SecurityRuyleSet.Level1)] to assembly to allow more relaxed inheritance security rules.Fixed a bug introduced in 2.1.0 related to security inheritance rules
Added RecyclableMemoryStreamManager constructor overloads that take parameters for specifying the maximum free pool sizes. Updated IntelliSense docume
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 explicitly set to avoid unbounded pool growth.GC.AllocateUninitializedArray in .NET 5.Span-related APIs via a dependency on System.Memory.Nothing published for this version
Nothing published for this version
Added netstandard2.0 target. There was an issue calling GetBuffer from a netstandard2.0 project, which would resolve to the netstandard1.4 target of R
GetBuffer from a netstandard2.0 project, which would resolve to the netstandard1.4 target of RMS. netstandard1.4 doesn't support overriding GetBuffer, so you could hit UnauthorizedAccessException.CopyToAsync. It was copying the entire stream, but the expected behavior based on System.IO.MemoryStream is to copy from the current position.CopyToAsync.Override CopyToAsync to save some allocations.
Minor updates
CopyToAsync to save some allocations.AllowPartiallyTrustedCallers attribute to assemblyWriteByte has been significantly optimized to be faster.
Performance Improvements
WriteByte has been significantly optimized to be faster.CheckDisposed, which is called in many code paths, has similarly been optimized.void WriteTo(Stream stream, int offset, int count) -- Allows you to write a portion of the current stream to a destination stream without first having
New API
void WriteTo(Stream stream, int offset, int count) -- Allows you to write a portion of the current stream to a destination stream without first having to call GetBuffer.Added RecyclableMemoryStreamManager.ThrowExceptionOnToArray. Causes a NotSupportedException to be thrown if RecyclableMemoryStream.ToArray is called.
Functionality
RecyclableMemoryStreamManager.ThrowExceptionOnToArray. Causes a NotSupportedException to be thrown if RecyclableMemoryStream.ToArray is called. Default is false.RecyclableMemoryStreamManager.GetStream that accept Memory<byte> arguments.Meta
Removed a buggy and unnecessary boundary check in Write methods.
Bug Fixes
Performance
Read, SafeRead, and Write that accept Span arguments (.NET Core and .NET Standard targets only)Functionality
TryGetBuffer, introduced in .NET Framework 4.6.Meta
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Bugs fixed when allocating very large streams.
Binaries on nuget.org are now signed through Microsoft.
Dispose() to be safe on double-dispose.- Initial release.
Your coding agent can read these notes before it upgrades. Set up the MCP server →