Skip to content

Commit

Permalink
Reduce buffer size used in XmlReader when using Async mode
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 dotnet#61459
  • Loading branch information
chrisdcmoore committed Jan 6, 2022
1 parent 634dfa1 commit 6ed6cc0
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 6ed6cc0

Please sign in to comment.