-
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
Proposal: SocketAsyncEventArgs.SetBuffer(Memory<T>) #20686
Comments
A couple thoughts on this: I wonder if Span (or Memory) is the way to do this. That is, if there's a way a Span can tell us that its memory is pre-pinned, then we could just add overloads that take Span (which it seems like we will probably want anyway) and then have them check if the given Span is pre-pinned. I chatted with @KrzysztofCwalina about this not too long ago; he was going to think about this... That said, if Span is not the right way to do this, then we could just add an unsafe overload that takes (byte *, length). This allows both pre-pinned and native memory. |
This would be an API we could add today that would be nice as well but |
Since we'd want to do the Memory one anyway to work with native memory, and since I think there are other overheads to work on removing first, I suggest we just hold off until that and then add that one. |
Should we fold this request into #19444? It tracks all BCL places that should start using Span & friends, once the API surface is final enough. |
@karelz I'm not a fan of uber issues like that. It's ok for overall tracking but each work item should have its own issue. |
@davidfowl I agree that the separate issues are valuable to discuss specific design points. However, |
One way to make it work for pre-pinned memory would be the following:
|
@KrzysztofCwalina that's a much less leaky way to implement it than it is today. Not sure you can cache the handle unless Free was a noop in this case (today it lowers the reference count) |
See discussion here:
dotnet/corefx#17237 (comment)
The text was updated successfully, but these errors were encountered: