Post
Instead of creating and destroying thousands of bullets per second, just recycle a fixed set of them -- like a ball pit for game objects.
Object pooling pre-allocates a fixed number of objects at startup and reuses them instead of creating new ones and destroying old ones at runtime. When the game needs a new bullet, it grabs an inactive one from the pool, resets its state, and activates it. When the bullet hits something or leaves the screen, it gets deactivated and returned to the pool. This eliminates the cost of memory allocation and deallocation, which is especially significant in garbage-collected languages like C# (Unity) where creating lots of short-lived objects triggers garbage collection pauses that cause visible frame rate hitches. Pools are used for anything that spawns frequently: bullets, particles, enemies, sound effects, UI elements, and network messages.
Example
Bullet hell games like Touhou or Enter the Gungeon can have thousands of projectiles on screen simultaneously. Without object pooling, creating and destroying each of these projectiles individually would cause constant garbage collection spikes. Instead, a pool of pre-allocated bullet objects is recycled endlessly, maintaining smooth frame rates even during the most chaotic patterns.
Why it matters
Memory allocation is one of the most common hidden performance killers in games. Object pooling is a simple pattern that eliminates an entire category of frame rate problems. It is one of the first optimizations any game developer should learn because the cost of not doing it is immediately visible as stuttering during intense gameplay moments.
Related concepts