Skip to content

Commit 15b7795

Browse files
authored
Merge pull request #1138 from Unity-Technologies/unity-master-tls-allocation
[Case 1084800] Fix issue where TLS requests would reallocate a buffer when it could reuse it
2 parents 084bac8 + b504480 commit 15b7795

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ public void Reset ()
7070
{
7171
Offset = Size = 0;
7272
TotalBytes = 0;
73-
Buffer = new byte[InitialSize];
73+
if (Buffer.Length <= InitialSize)
74+
Array.Clear (Buffer, 0, Buffer.Length);
75+
else
76+
Buffer = new byte[InitialSize];
7477
Complete = false;
7578
}
7679

0 commit comments

Comments
 (0)