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:

    “Organize first for knowledge, first with the object of making us know ourselves as a nation, for we have to do that before we can be of value to other nations of the world and then organize to accomplish the things that you decide to want. And ... don’t make decisions with the interest of youth alone before you. Make your decisions because they are good for the nation as a whole.”
    —Eleanor Roosevelt (1884–1962)

    “... this dream that men shall cease to waste strength in competition and shall come to pool their powers of production is coming to pass all over the earth.”
    —Jane Addams (1860–1935)

    “His talent was as natural as the pattern that was made by the dust on a butterfly’s wings. At one time he understood it no more than the butterfly did and he did not know when it was brushed or marred. Later he became conscious of his damaged wings and of their construction and he learned to think and could not fly any more because the love of flight was gone and he could only remember when it had been effortless.”
    —Ernest Hemingway (1899–1961)