Releases: microsoft/Microsoft.IO.RecyclableMemoryStream
Releases · microsoft/Microsoft.IO.RecyclableMemoryStream
Microsoft.IO.RecyclableMemoryStream 3.0.1
Bug Fix
Fix infinite loop bug when calling (Try)GetBuffer on a stream longer than 1 GB when using the UseExponentialLargeBuffer option. (Issue #344)
Microsoft.IO.RecyclableMemoryStream 3.0.0
Breaking Changes
- Removed
int
-based constructor andGetStream
overloads wherelong
-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 typeRecyclableMemoryStream
instead ofMemoryStream
. - 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 newRecyclableMemoryStreamManager.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.
Microsoft.IO.RecyclableMemoryStream 2.3.2
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.
Microsoft.IO.RecyclableMemoryStream 2.3.1
New Feature:
- Stream lifetime (creation through dispose) is now tracked and reported through the
MemoryStreamDispose
EventSource
event, as well as through theStreamDisposed
.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.
Microsoft.IO.RecyclableMemoryStream 2.2.1
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.
Microsoft.IO.RecyclableMemoryStream 2.2.0
API changes:
- Add an override for
GetStream
that takes aReadOnlySpan<byte>
. This supercedes the versions ofGetStream
that takeMemory<byte>
, which were marked as[Obsolete]
.
Bug Fixes:
- Fixed:
GetReadOnlySequence()
throwsArgumentOutOfRangeException
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.
Microsoft.IO.RecyclableMemoryStream 2.1.3
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.
Microsoft.IO.RecyclableMemoryStream 2.1.2
Changes:
- Fixed an integer overflow bug when buffer sizes are near
Int32.MaximumValue
Microsoft.IO.RecyclableMemoryStream 2.1.1
- Fixed a bug introduced in 2.1.0 related to security inheritance rules
Microsoft.IO.RecyclableMemoryStream 2.1.0
- 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