Original Post
Hello, In my game (but it's a general question..), I am using a pool implementation designed by myself, that is: which may be flawed. It is composed of a vector or list of dynamically-allocated arrays of a fixed size which I call 'clusters'. The template signature is something like: Pool. The pool allocates a new cluster on the heap every time its capacity needs to be expanded. Only a few clusters should exist at a time, not zillions, it's more of a convenience trick. I wrote it like this so that I don't have to bother whether the pool is depleted and handle special cases, as it cannot happen (well, unless the system runs out of memory of course). That way, it also suits a broader range of applications. However, doesn't a heap-allocated pool defeats the goal of the concept? I am wondering whether I should use a simpler, stack-allocated pool with a fixed, large capacity (a part of it remaining unused). Or with a not-so-large capacity but with a pool depletion handling system. What do you think (regarding performance, memory fragmentation, anything...)?