-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Add IMemoryPoolFactory to Connections.Abstractions #61003
Copy link
Copy link
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Background and Motivation
Kestrel (and other server impls) use the PinnedBlockMemoryPool for the core IO processing. The usage is purely internal today and also has the issue of never releasing its memory resulting in users thinking there is a memory leak. See: #55490
As part of wanting to reduce the memory when the pool is idle we want to use a timer, but creating a timer per pool is not ideal, so we want to put the cleanup on the kestrel heartbeat thread which requires sharing between Sockets, NamedPipes, and Kestrel Core. Ideally we want to avoid internals visible to, so in order to solve this we need a type that can be used by all dlls and shared via DI so we can wire up the pool usage everywhere.
Proposed API
Microsoft.AspNetCore.Connections.Abstractions.dll
Usage Examples
Alternative Designs
Alternatively we can use
[InternalsVisibleTo]on some of our assemblies.Risks
N/A