tags:

views:

174

answers:

1

I have a COM+ data service that is configured to use object pooling with a min and max pool size of 1. So I have a singleton. In some scenarios my Object count (the number of clients that have a reference to this instance) goes beyond 1 and steadily increases. The instance creation and the one call to its method is wrapped in a using stmt, so that instance should be properly returned to the pool. At the same time this occurs I see some network problems ( transport-level error Exceptions with SQLServer). I suspect that there may be some correlation there.

How is it that Object count increases beyond 1?

A: 

You are seeing the effects of JIT (just-in-time activation) with object pooling.

With JIT, multiple clients can have references to the same object and all the method calls can be serviced by the same instance. Each client keeps only a reference to a context object. After a method is called, if the method set the Done flag in the context, the object is disconnected from the context and put back in the pool ready to be used by another method call from another client. This saves resources because many clients can be serviced by the single object.

See the following: COM+ Just-in-Time Activation Concepts

Carlos A. Ibarra