Clear the buffers fields (#49575)
authorDavid Fowler <davidfowl@gmail.com>
Mon, 15 Mar 2021 22:27:16 +0000 (15:27 -0700)
committerGitHub <noreply@github.com>
Mon, 15 Mar 2021 22:27:16 +0000 (15:27 -0700)
- This makes it easier to reason about gcroots in dumps

src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/Pipe.cs
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeWriter.cs

index caf0767..1abb6be 100644 (file)
@@ -795,6 +795,7 @@ namespace System.IO.Pipelines
                 }
 
                 _writingHead = null;
+                _writingHeadMemory = default;
                 _readHead = null;
                 _readTail = null;
                 _lastExaminedIndex = -1;
index 079fe29..3da5aff 100644 (file)
@@ -328,6 +328,7 @@ namespace System.IO.Pipelines
                     // Mark bytes as written *after* flushing
                     _head = null;
                     _tail = null;
+                    _tailMemory = default;
                     _bytesBuffered = 0;
 
                     return new FlushResult(isCanceled: false, isCompleted: false);
@@ -395,6 +396,7 @@ namespace System.IO.Pipelines
             // Mark bytes as written *after* flushing
             _head = null;
             _tail = null;
+            _tailMemory = default;
             _bytesBuffered = 0;
         }
     }