Object Pool Pattern

The object pool pattern is a software creational design pattern that uses a set of initialised objects kept ready to use, rather than allocating and destroying them on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished, it returns the object, which is a specific type of factory object, to the pool rather than destroying it.

Object pooling can offer a significant performance boost in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instances in use at any one time is low. The pooled object is obtained in predictable time when creation of the new objects (especially over network) may take variable time.

However these benefits are mostly true for objects that are expensive with respect to time, such as database connections, socket connections, threads and large graphic objects like fonts or bitmaps. In certain situations, simple object pooling (that hold no external resources, but only occupy memory) may not be efficient and could decrease performance.

Read more about Object Pool Pattern:  Handling of Empty Pools, Pitfalls, Criticism, Examples

Famous quotes containing the words object, pool and/or pattern:

    A poet’s object is not to tell what actually happened but what could or would happen either probably or inevitably.... For this reason poetry is something more scientific and serious than history, because poetry tends to give general truths while history gives particular facts.
    Aristotle (384–323 B.C.)

    Just getting in the pool for seven straight hours is unbearable to me.... It’s grueling. There’s nothing physically pleasurable about it. If you’re doing a hard workout, you’re throwing up in the gutter. At night you cling to your pillow and just hope that your body revives before you have to go back and do it again.
    Diana Nyad (b. 1949)

    Although the pattern prevailed,
    The breaks were everywhere. That she could think
    Of no thread capable of the necessary
    Sew-work.
    Gwendolyn Brooks (b. 1917)