Skip to content

do Socket.Receive/SendAsync(Memory<byte>) allocate memory on each call? #104475

Closed Answered by elgonzo
freddyrios asked this question in General
Discussion options

You must be logged in to vote

Sets it to null if the previous value matched the current instance + disposes the current instance:

You did read the Interlocked.CompareExchange wrong. The last parameter in Interlocked.CompareExchange(ref cache, this, null) is the value compared against. Therefore, it sets cache to this if the value of cache is null (and disposes the current instance if there is already some non-null instance in cache).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@freddyrios
Comment options

Answer selected by teo-tsirpanis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants