jargon

Design patterns·Making things

the object is not created and destroyed, it is borrowed and given back, and forgetting to give it back exhausts everything.

Object pool

Also calledpooling, resource pool, object pooling

Keeping a set of expensive-to-create objects alive and lending them out, instead of constructing one per use. It is the right answer for things whose cost is a handshake rather than an allocation — connections, threads, large buffers — and almost always the wrong answer for plain objects in a language with a generational collector. Its two characteristic bugs are leaked handles that never return and state left over from the previous borrower.

Commonly confused with