Currently, I have all my objects managing their own memory, allocating with new
in their constructors typically, and using delete
in their destructors. This works for now, but the number of classes I have that use arbitrary amounts of memory is growing. The fact that new
is essentially a "request" also bothers me, since these objects have no code within them to handle being told "no", and I don't want to rely on Exception Handling if I do not need to.
Is it beneficial in terms of performance to completely shield all calls that allocate memory, to a single class that handles every memory allocation on the heap, probably allocating large chunks at a time and using placement new to deal out references?
Is the use of memory allocation in smaller classes a big enough concern to even bother with this?
Can I still use STL containers and force them to use the heap I provide?
Thank you in advance!