Skip to content

Replaced Span<T>.Fill(0) with Span<T>.Clear() #20023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Server/src/BlazorPack/SequenceOfT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ private void ClearReferences(int startIndex, int length)
// If we store references, clear them to allow the objects to be GC'd.
if (!IsValueTypeElement)
{
this.AvailableMemory.Span.Slice(startIndex, length).Fill(default);
this.AvailableMemory.Span.Slice(startIndex, length).Clear();
Copy link
Member

@SteveSandersonMS SteveSandersonMS Mar 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BlazorPack sources are shared-source with MessagePack-CSharp, so to update this the process would be:

  • Have the desired update made in the MessagePack-CSharp repo
  • Update the sources in this repo to match the latest state in MessagePack-CSharp

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info --> MessagePack-CSharp/MessagePack-CSharp#848

You've submitted a PR that modifies code that is shared with https://github.com/dotnet/runtime .

The bot is somewhat misleading as it speaks about "runtime"-repo. Humans are still smarter 😉

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ protected Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePai

HPackHeaderWriter.BeginEncodeHeaders(GetHeadersEnumerator(headers), payload, out var length);
var padding = buffer.Slice(extendedHeaderLength + length, padLength);
padding.Fill(0);
padding.Clear();

frame.PayloadLength = extendedHeaderLength + length + padLength;

Expand Down
4 changes: 2 additions & 2 deletions src/Shared/Http2cat/Http2Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public Task SendHeadersWithPaddingAsync(int streamId, IEnumerable<KeyValuePair<s

HPackHeaderWriter.BeginEncodeHeaders(GetHeadersEnumerator(headers), payload, out var length);
var padding = buffer.Slice(extendedHeaderLength + length, padLength);
padding.Fill(0);
padding.Clear();

frame.PayloadLength = extendedHeaderLength + length + padLength;

Expand Down Expand Up @@ -431,7 +431,7 @@ public Task SendHeadersWithPaddingAndPriorityAsync(int streamId, IEnumerable<Key

HPackHeaderWriter.BeginEncodeHeaders(GetHeadersEnumerator(headers), payload, out var length);
var padding = buffer.Slice(extendedHeaderLength + length, padLength);
padding.Fill(0);
padding.Clear();

frame.PayloadLength = extendedHeaderLength + length + padLength;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal NativeRequestContext(SafeNativeOverlapped nativeOverlapped, MemoryPool<
// No size limit
_backingBuffer = MemoryPool<byte>.Shared.Rent(newSize);
}
_backingBuffer.Memory.Span.Fill(0);// Zero the buffer
_backingBuffer.Memory.Span.Clear();
_memoryHandle = _backingBuffer.Memory.Pin();
_nativeRequest = (HttpApiTypes.HTTP_REQUEST*)((long)_memoryHandle.Pointer + _bufferAlignment);

Expand Down