Memory allocation in the C++ standard library
The standard containers will use the allocator provided to them to allocate dynamic memory. By default, that is std::allocator
.
For most other dynamic memory uses in the standard library, the standard doesn't specify how the implementation should acquire memory, and the implementation has the freedom to do what they want.
As for tracking memory allocations, I recommend wrapping malloc
.