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:

    The Dada object reflected an ironic posture before the consecrated forms of art. The surrealist object differs significantly in this respect. It stands for a mysterious relationship with the outer world established by man’s sensibility in a way that involves concrete forms in projecting the artist’s inner model.
    —J.H. Matthews. “Object Lessons,” The Imagery of Surrealism, Syracuse University Press (1977)

    I caught a blackjack right behind my ear. A black pool opened up at my feet. I dived in. It had no bottom. I felt pretty good—like an amputated leg.
    John Paxton (1911–1985)

    It is just possible that the tensions in a novel of murder are the simplest and yet most complete pattern of the tensions on which we live in this generation.
    Raymond Chandler (1888–1959)