avoid GCHandle in ConnectEx and SendTo on Windows#86524
Merged
stephentoub merged 2 commits intodotnet:mainfrom May 20, 2023
Merged
avoid GCHandle in ConnectEx and SendTo on Windows#86524stephentoub merged 2 commits intodotnet:mainfrom
stephentoub merged 2 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsSocketAddress needs to be preserved only for initial call of ConnextEx and SendTo. There is no need to allocate GCHandle (and hold do it through connection time) AFAIK interop should now generate This helps to avoid memory fragmentation through small pinned buffers and contributes to #86513 and #30797. I will follow up on
|
stephentoub
reviewed
May 19, 2023
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSASendTo.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
May 19, 2023
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSASendTo.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
May 19, 2023
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
May 19, 2023
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
May 19, 2023
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
May 19, 2023
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs
Outdated
Show resolved
Hide resolved
This was referenced May 19, 2023
antonfirsov
reviewed
May 20, 2023
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Show resolved
Hide resolved
antonfirsov
approved these changes
May 20, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SocketAddress needs to be preserved only for initial call of ConnextEx and SendTo. There is no need to allocate GCHandle (and hold do it through connection time)
AFAIK interop should now generate
fixedautomatically forSpanso we can simply pass it in.This helps to avoid memory fragmentation through small pinned buffers and contributes to #86513 and #30797.
I will follow up on
ReceiveFromseparatelly as this part at least fixes TCP and issue observed by customer.