Object pool pattern: Difference between revisions

Content deleted Content added
Clean up some English
m templates, cat
Line 1:
{{wikify}}
{{cleanup-date|October 2005}}
In [[computer programming]], an '''object pool''' is a construct of objects which can be used concurrently. Typically, a client object which requires resources which are managed by the object pool will request an object from the pool and perform operations on the returned object. Object pooling offers a significant performance boost and is most efficient in situations where the cost of initializing a class instance is high and the amount of instantiations of a particular class is also frequent.
 
Line 20 ⟶ 22:
 
The typical fix for this situation is to mandate a "clean" method on each interface type the object pool supports. Objects are then cleared of state just prior to returning instances to clients, or just after they are passed back into the pool. For more complex objects, two methods may be required; one to clean up state and free resources when the object is returned to the pool, and one to prepare the object just before it is passed out of the pool to a client.
 
[[Category: Programming constructs]]