Issues with object pools
Now, as great as object pools are, we should take some time to talk about times when you would not want to use object pools, and the alternatives out there.
First of all, you need to remember that when you are using a memory manager, you are telling the computer that you are smarter than them and that you know how the data should be handled. This is more power than other languages tend to give you, and using Uncle Ben's famous line, "with great power comes great responsibility" as we mentioned previously in this book in Chapter 2, One Instance to Rule Them All - Singletons. When using an object pool, you typically want to use it when objects only have a limited lifetime and a lot of them will be created, but not all at the same time. If at one point in time you'll have 10,000 on the screen, but the rest of the game you'll have 30 max, that 9,970 other objects' worth of memory will just be standing there waiting for you in the unlikely event that you want to use it...