Skip to content
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

Merged
merged 2 commits into from
May 20, 2023

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented May 19, 2023

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 for Span 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.

@wfurt wfurt added this to the 8.0.0 milestone May 19, 2023
@wfurt wfurt requested review from stephentoub and a team May 19, 2023 19:02
@wfurt wfurt self-assigned this May 19, 2023
@ghost
Copy link

ghost commented May 19, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

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 for Span 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.

Author: wfurt
Assignees: wfurt
Labels:

area-System.Net.Sockets, os-windows

Milestone: 8.0.0

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

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

Nice.

@stephentoub stephentoub merged commit 82327bb into dotnet:main May 20, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants