Skip to content

Commit

Permalink
Reduce buffer size used in XmlReader when using Async mode (#63459)
Browse files Browse the repository at this point in the history
The current choice of AsyncBufferSize resulted in the character buffer in the XmlTextReader being allocated on the Large Object Heap (LOH)

Fixes #61459
  • Loading branch information
chrisdcmoore authored Jan 24, 2022
1 parent 773e822 commit d964b63
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public abstract partial class XmlReader : IDisposable
internal const int BiggerBufferSize = 8192;
internal const int MaxStreamLengthForDefaultBufferSize = 64 * 1024; // 64kB

internal const int AsyncBufferSize = 64 * 1024; //64KB
// Chosen to be small enough that the character buffer in XmlTextReader when using Async = true
// is not allocated on the Large Object Heap (LOH)
internal const int AsyncBufferSize = 32 * 1024;

// Settings
public virtual XmlReaderSettings? Settings => null;
Expand Down

0 comments on commit d964b63

Please sign in to comment.