-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
avoid GCHandle in ConnectEx and SendTo on Windows #86524
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
|
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSASendTo.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSASendTo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
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
fixed
automatically forSpan
so 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
ReceiveFrom
separatelly as this part at least fixes TCP and issue observed by customer.