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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access