MemoryStream allocates arrays in LOH, and it is inefficient.
Along the lines what MSFT did with RecyclablememoryStream, we could use Pile as memory manager or use RecyclableMemoryStream by MSFT as a drop-in replacement.
This deals with perf critical code where MemoryStream gets allocated/released many times.
See:
MemoryStream allocates arrays in LOH, and it is inefficient. Along the lines what MSFT did with RecyclablememoryStream, we could use Pile as memory manager or use RecyclableMemoryStream by MSFT as a drop-in replacement.
This deals with perf critical code where MemoryStream gets allocated/released many times. See:
https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream
The design needs to be re-evaluated in the light of: Pile, and ArrayPool/ Memory no to create code duplication