Skip to content

Commit d964b63

Browse files
authored
Reduce buffer size used in XmlReader when using Async mode (#63459)
The current choice of AsyncBufferSize resulted in the character buffer in the XmlTextReader being allocated on the Large Object Heap (LOH) Fixes #61459
1 parent 773e822 commit d964b63

File tree

1 file changed

+3
-1
lines changed
  • src/libraries/System.Private.Xml/src/System/Xml/Core

1 file changed

+3
-1
lines changed

src/libraries/System.Private.Xml/src/System/Xml/Core/XmlReader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public abstract partial class XmlReader : IDisposable
8181
internal const int BiggerBufferSize = 8192;
8282
internal const int MaxStreamLengthForDefaultBufferSize = 64 * 1024; // 64kB
8383

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

8688
// Settings
8789
public virtual XmlReaderSettings? Settings => null;

0 commit comments

Comments
 (0)