Object pool pattern: Difference between revisions

Content deleted Content added
Extended from ther references at the bottom
Line 1:
In [[computer programming]], an '''object pool''' is a software [[design pattern (computer science)|design pattern]]. An '''object pool''' is a set of initialised [[Object (computer science)|objects]] that are kept ready to use, rather than allocated and destroyed 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 with an object, it returns it to the pool, rather than destroying it. It is a specific type of [[factory object]].
 
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. ThisThe pooled object is oftenobtained in predictable time when creation of the new objects (especially over network) may take variable time.

However these benefits are mostly true for objects like database connections, socket connections, threads and large graphic objects like fonts or bitmaps. Simple object pooling (which hold no external resources, but only occupy memory) is not as efficient and may even decrease the performance [http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-jw22JavaUrbanLegends].
 
== Handling of empty pools ==