Dynamic memory allocation is a natural solution for many common programming problems. In C++, new-expressions allocate dynamic memory through a function called operator new. Unfortunately, the compiler-provided implementation of operator new is often expensive to run, non-deterministic, and risks fragmenting memory over time. As a result, too many resource-constrained systems (e.g., embedded, real-time, or high-performance applications) avoid using new-expressions altogether. This is unfortunate because C++ new-expressions were designed to be highly customizable for such purposes.
This session shows how to implement customized dynamic memory managers for use in resource-constrained systems. It presents multiple forms of operator new and operator delete and explains the language mechanisms behind them. It shows how you can replace the compiler-provided operator new and operator delete with your own implementation, either globally or for individual classes. You’ll leave with a clearer understanding of how new and delete work and how you can tailor them to meet the demands of many resource-constrained applications.