Skip to main content
Reservoir / .NET 10+runtime package

Stop allocating the same thing twice.

Bounded, thread-safe object pools with a 0 B warm path. One small runtime library works across application and package boundaries.

dotnet add package Reservoir
POOL / BUFFER warm path
retained14/ 16
global locksnone
delivery.dll NuGet
11.83 nswarm rent + return
0 Ballocated on every measured warm path
64 slotscapacity is explicit and bounded
BenchmarkDotNet · ShortRun · .NET 10 · i7-12700K
The ownership contract

Rent. Work. Return.

A small lifecycle that stays explicit, even under contention. The pool owns retention; your policy owns creation, reset, and cleanup.

BufferPool.cslexical ownership
var pool = new
    ObjectPool<Buffer, BufferPolicy>(64);

using var lease = pool.RentScoped(
    out Buffer buffer);

buffer.Write(payload);
// reset + return at scope exit
  1. 01 / rent

    Take sole ownership

    Rent from a per-thread stripe. A miss asks your policy to create an instance.

  2. 02 / work

    Use it like it is yours

    Because it is—until return. No wrapper sits between your code and the object.

  3. 03 / return

    Transfer ownership back

    The policy resets it. Oversized or invalid objects are destroyed instead of retained.

Why Reservoir

Performance with edges.

Bounded by design

A pool, not a leak.

Fixed retention limits keep memory behavior legible. Capacity controls idle objects, never the number of concurrent rentals.

maxCapacity
Library ready

One package. One identity.

Public types flow transitively through PackageReference graphs while the JIT specializes concrete struct policies across the assembly boundary.

Reservoir.dll
Scoped ownership

Return by construction.

Stack-only leases return rentals when synchronous work leaves scope, including exceptional control flow.

PooledLease<T>
Useful on install

Common pools,
already primed.

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 pools
pool typelargest retained
List<T>1,024
Dictionary<TKey, TValue>1,024
HashSet<T>1,024
Queue<T>1,024
Stack<T>1,024
StringBuilder4,096
CancellationTokenSourcereset-safe
NuGetReservoir.dllyour application
Conventional PackageReference

Install once.
Share the types.

One runtime dependency, one public type identity, and no source injection into consumer compiler or analyzer settings.