Why does C# memory stream reserve so much memory?
Because this is the algorithm for how it expands its capacity. public override void Write(byte[] buffer, int offset, int count) { //… Removed Error checking for example int i = _position + count; // Check for overflow if (i < 0) throw new IOException(Environment.GetResourceString(“IO.IO_StreamTooLong”)); if (i > _length) { bool mustZero = _position > _length; … Read more