bw logo

Chapter 1. Introduction

Memory leaks occur when allocated memory is never deallocated as a result of program error. Memory leaks can result in degraded performance over time for all applications on the system, and are especially problematic for real-time or embedded applications.

Non-trivial C++ programs can contain thousands of explicit memory management calls, resulting in millions of allocations and deallocations throughout the life of a program. Worse still, commonly used libraries such as the STL can add thousands of implicit allocations that are far less obvious. The burden of managing these and correctly freeing allocated memory is generally placed on the programmer.

When memory leaks occur they are often very hard to find manually. Numerous third party tools like BoundsChecker and Purify are available for Windows. However these are active methods of finding memory issues, whereas we require a passive method. That is, we need to know exactly when leaks occur without having to add instrumentation, build a particular configuration, or run an external tool. External tools are more useful for investigating known leaks when more data is needed.