From 6795ca2f78e6fe2cd1d90b1419677b6f64404cf5 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 31 Aug 2016 01:17:56 -0700 Subject: [PATCH] Make the char array for utf8 decoding smaller --- .../Internal/Infrastructure/MemoryPoolIteratorExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs index dcaf4f0fcf..6bb47c0578 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/MemoryPoolIteratorExtensions.cs @@ -150,7 +150,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure var decoder = _utf8.GetDecoder(); var length = start.GetLength(end); - var charLength = length * 2; + var charLength = length; + // Worse case is 1 byte = 1 char var chars = new char[charLength]; var charIndex = 0;