views:

56

answers:

2

Hello,

In our C# (.NET 4.0) application, we allocate and de-allocate a lot of memory, in different size chunks. We want to move to an object pool, to improve performance.

We implemented an object pool already and saw some performance improvement. We're currently using a stack-based backing store. Other possible alternatives are, queue based store, ConcurrentBag<> based store, List<> based store, etc.

I guess the choice of backing store really depends on the application's characteristics, so we're now in the process of implementing the object pool with all these different backing stores and testing the performance.

However, I'd really like to hear your thoughts on pros and cons of different backing stores for object pooling.

Thanks

A: 

u can use spring as a container it has a good object pool and other IOC requierments.

SaeedAlg
A: 

What is the life time of objects that you want to store in the object pool?

Most probably singletons so you need a bag which can store higly expensive singleton objects.

And you can query this bag to get the object.

Have you considerd Unity Framework?

If this is not the choice and you want to have some simple container than use Dictionary which is much faster to access.

saurabh