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:

    I began my editorial career with the presidency of Mr. Adams, and my principal object was to render his administration all the assistance in my power. I flattered myself with the hope of accompanying him through [his] voyage, and of partaking in a trifling degree, of the glory of the enterprise; but he suddenly tacked about, and I could follow him no longer. I therefore waited for the first opportunity to haul down my sails.
    William Cobbett (1762–1835)

    I’ th’ world’s volume
    Our Britain seems as of it, but not in’ t;
    In a great pool a swan’s nest.
    William Shakespeare (1564–1616)

    Why it was that upon this beautiful feminine tissue, sensitive as gossamer, and practically blank as snow as yet, there should have been traced such a coarse pattern as it was doomed to receive; why so often the coarse appropriates the finer thus, the wrong man the woman, the wrong women the man, many years of analytical philosophy have failed to explain to our sense of order.
    Thomas Hardy (1840–1928)