-
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
ArrayMemoryPool.ArrayMemoryPoolBuffer implementation does not dispose if the ref count reaches 0 #25236
Comments
Seems to me the refcount is about tracking the lifetime of the pinned |
@atsushikan did that change during the port? As you can see that wasn't originally the case but we need to clarify the contract because pipelines is relying on these semantics for correctness. Also our ASP.NET Core |
Yes, it did change during the port. |
Right, let's clarify the contract. I've put in my two cents, but let's see what the api guys think. |
Yeah, ArrayMemoryPoolBuffer is supposed to auto-dispose when refcount drops to zero. |
I think it's worth having some |
@GrabYourPitchforks, once we decide what semantics we want, we will decide who does the work. |
actually, I noticed this is fixed. So just make sure the semantics are what we want. |
Seems like when we ported this from corefxlab we removed a bunch of functionality. Originally the implementation called Dispose on the reference count = 0:
https://github.com/dotnet/corefxlab/blob/c81145ba362ca6649dcf97ae662869f7005061ee/src/System.Buffers.Primitives/System/Buffers/Pooling/ArrayMemoryPool.cs#L91-L97
Now it does nothing.
https://github.com/dotnet/corefx/blob/master/src/System.Memory/src/System/Buffers/ArrayMemoryPool.ArrayMemoryPoolBuffer.cs#L88
This is making pipelines basically leak memory like crazy when using this pool implementation (which is now the default). Can we clarify on the semantics here ASAP?
/cc @stephentoub @KrzysztofCwalina @ahsonkhan @atsushikan
The text was updated successfully, but these errors were encountered: