Is there a general-purpose object pool for .NET?

Viewed 9238

I have a class that is expensive to construct, in terms of time and memory. I'd like to maintain a pool of these things and dispense them out on demand to multiple threads in the same process.

Is there a general-purpose object pool that is already tested and proven? (I don't want COM+ pooling.)

6 Answers

The accepted answer is no longer correct in 2021.

There is Microsoft.Extensions.ObjectPool NuGet package, that provides two implementations of object pool DefaultObjectPool<T> and LeakTrackingObjectPool<T>

Related