
In high-performance web applications, memory management is often the silent bottleneck. Long-running apps—APIs, gRPC services, and real-time applications—rely heavily on pooled buffers to reduce allocations and minimize GC overhead. Historically, these pools could grow aggressively under load and retain large chunks of memory even during idle periods, which often led to confusing memory footprints, container OOM issues, or high Gen 2 heap usage.
With .NET 10, the runtime introduces automatic trimming of unused pooled memory. This enhancement is runtime-wide, so any C# application using pooled buffers benefits. However, ASP.NET Core sees the most dramatic improvements because its request/response pipelines, Kestrel buffers, JSON serialization, and networking I/O frequently rent large buffers under load. Now, after bursts of traffic, idle buffers are released automatically, lowering memory usage and GC pressure— all without changing your application code.
In this article, we’ll explore how pooling works in ASP.NET Core, show real before-and-after scenarios, and highlight best practices and anti-patterns to maximize the benefits of smarter memory management in .NET 10.
In this post, we’ll explore:
Why pooled memory has historically been a problem
What changed in .NET 10
How ASP.NET Core benefits automatically
What this means for your own code
Real-world examples and best practices
The Hidden Cost of Memory Pools in Long-Running Apps
Memory pooling is one of the reasons ASP.NET Core is so fast. Internally, it uses pools for:
ArrayPool<T>Kestrel buffers
Request/response pipelines
JSON serialization
Networking and I/O
The idea is simple:
Reuse memory instead of constantly allocating and freeing it.
The Problem
In long-running applications, memory pools tend to grow to peak usage and then never shrink, even when traffic drops.
This leads to:
Higher steady-state memory usage
Larger GC heaps
More GC pause time
Increased container and VM costs
Risk of OOM in Kubernetes environments
Historically, once a pool grew, it stayed big forever.
What’s New in .NET 10
Starting with .NET 10, pooled memory management becomes adaptive and self-correcting.
Key Improvement
Unused pooled memory is automatically released back to the GC when it is no longer needed.
This applies to:
ArrayPool<T>and internal framework poolsASP.NET Core request infrastructure
Kestrel’s buffer management
The runtime now:
Tracks real usage patterns
Detects sustained idle memory
Gradually trims pools under low pressure
Cooperates with the GC instead of fighting it
⚠️ Important: This behavior is automatic. Most applications require zero code changes.
Why This Matters for ASP.NET Core
Before .NET 10
Traffic spike → pool grows → traffic drops → memory stays allocated With .NET 10
Traffic spike → pool grows → traffic drops → pool shrinks → memory released 
This is a huge win for:
APIs running 24/7
Background services
Multi-tenant systems
Kubernetes and container-based hosting
Azure App Services with memory limits
ASP.NET Core Pooling Examples:
1. ArrayPool<T> – Manual Buffer Pooling
Scenario
You need temporary buffers for CPU or I/O heavy operations without allocating repeatedly.
Example
using System.Buffers;
public static class BufferProcessor
{
public static void Process()
{
var pool = ArrayPool<byte>.Shared;
byte[] buffer = pool.Rent(1024 * 1024); // 1 MB
try
{
// Simulate work
buffer[0] = 42;
}
finally
{
pool.Return(buffer, clearArray: false);
}
}
}
Why This Matters
Avoids frequent allocations
Reduces GC pressure
In .NET 10, unused buffers are now automatically released during idle periods
2. Kestrel Buffers – High-Performance Request Handling
Scenario
Kestrel internally pools buffers for handling HTTP requests and responses.
Example (Custom Server Limits)
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(options =>
{
options.Limits.MaxRequestBufferSize = 1024 * 1024; // 1 MB
options.Limits.MaxResponseBufferSize = 1024 * 1024;
});
var app = builder.Build();
app.MapGet("/", () => "Hello from pooled Kestrel buffers!");
app.Run();
Join the conversation! Your thoughts help the community grow.