Appendix B. The Prevention of Memory Leakage

One of the most dangerous pitfalls affecting the C++ community is that of memory leakage, or the unintentional nondeletion of dynamically allocated memory. A system inflicted with this problem will run correctly for some period of time, often weeks, with no discernable problem. It will then “seize up,” that is, run out of heap space for no apparent reason. The operator typically reboots the application, which again runs problem-free. The danger of this situation is that it is not caught at compile, link, or test-run time. It is detected only after the product has been shipped to a number of clients.

While memory leakage has occurred in standard C applications, it is typically introduced into that environment ...

Get Object-Oriented Design Heuristics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.