In C++ there are several ways to replace memory allocations. new/delete can trivially be globally replaced, and class/struct can expose static member new/delete (for itself). The major cost comes from std::vector. We barely use std::string and std::array is stack-allocated. All member integrals and arrays are allocations of the containing class/struct. We also need to consider that this technique needs to be strictly limited to objects that we can track (or more specifically can track themselves). So for example, a block can encapsulate a memory tracking pointer and new memory can thus be allocated when all of these are freed, and no new memory allocated while waiting for that to be the case. Within that block all allocations can be based on a replaced allocator.