-
Book Overview & Buying
-
Table Of Contents
C++ Memory Management
By :
In Chapter 9, we showed some examples of unusual memory allocation mechanisms and how they can be used, including how to react to errors to give our programs a form of “second chance” to continue, as well as how to use atypical or exotic memory through the mediation of the C++ language facilities. Then, in Chapter 10, we examined arena-based allocation and some variants thereof with an eye on issues of speed, determinism, and control over resource consumption.
What we will do in the current chapter is something that is not often done in C++ but that is common practice in programs written in many other languages, particularly those with integrated garbage collectors: we will write mechanisms that delay the destruction of dynamically allocated objects at selected moments in the execution of a program.
We will not write a proper garbage collector, as that would involve deeper involvement in the inner workings of the compiler and impact the programming...