A pool, not a leak.
Fixed retention limits keep memory behavior legible. Capacity controls idle objects, never the number of concurrent rentals.
maxCapacityBounded, thread-safe object pools with a 0 B warm path. One small runtime library works across application and package boundaries.
dotnet add package ReservoirA small lifecycle that stays explicit, even under contention. The pool owns retention; your policy owns creation, reset, and cleanup.
var pool = new
ObjectPool<Buffer, BufferPolicy>(64);
using var lease = pool.RentScoped(
out Buffer buffer);
buffer.Write(payload);
// reset + return at scope exitRent from a per-thread stripe. A miss asks your policy to create an instance.
Because it is—until return. No wrapper sits between your code and the object.
The policy resets it. Oversized or invalid objects are destroyed instead of retained.
Fixed retention limits keep memory behavior legible. Capacity controls idle objects, never the number of concurrent rentals.
maxCapacityPublic types flow transitively through PackageReference graphs while the JIT specializes concrete struct policies across the assembly boundary.
Reservoir.dllStack-only leases return rentals when synchronous work leaves scope, including exceptional control flow.
PooledLease<T>Shared pools arrive ready for collections, text building, and cancellation. Collections return empty; unusually large backing stores do not return at all.
Explore built-in poolsList<T>1,024Dictionary<TKey, TValue>1,024HashSet<T>1,024Queue<T>1,024Stack<T>1,024StringBuilder4,096CancellationTokenSourcereset-safeOne runtime dependency, one public type identity, and no source injection into consumer compiler or analyzer settings.