Object pool pattern: Difference between revisions

Content deleted Content added
Line 51:
| quote =
| accessdate = 2012-08-28
}}</ref> Opponents usually say that object allocation is relatively fast in modern languages with [[Garbage collection (computer science)|garbage collectors]]; while the operator "<code>new"</code> needs only 10ten instructions, the classic <code>new</code> - <code>delete</code> pair found in pooling designs requires hundreds of them as it does more complex work. Also, most garbage collectors scan "live" object references, and not the memory that these objects use for their content. This means that any number of "dead" objects without references can be discarded with little cost. In contrast, keeping a large number of "live" but unused objects increases the duration of garbage collection<ref name="urban" />. In some cases, programs that use garbage collection instead of directly managing memory may run faster.
 
== Examples ==