Definitive guide to object pooling with C# in .NET 3.5

Recently I had considerations of needing to implement an object pool in my application and I know concurrency issues are one of the most insidious and complex issues to overcome correctly in programming regardless of language. Understanding this I knew I’d be better offer finding a very defined example that handles the concurrency issues of an object pool and defer to a source that has more experience with concurrency and use their information as a starting point for my specific needs. Normally this works great however in this situation I found very little relevant information on Google for this problem. It’s possible my Google-fu just wasn’t on point for finding the most relevant articles but almost all information I found had the very threading issues I was concerned about as part of their example (ie they just ignored it or weren’t aware of it).

This lead me to query the knowledge base of developers on StackOverflow which didn’t add much to my equation at the start however I instituted a bounty over this question and got one of the most complete answers I’ve ever seen in response to a question that addresses basically every single need required of an object pool correctly. Read over all of the great information I got on this topic at C# Object Pooling Pattern implementation

Advertisements