Memory Leak Detection and Isolation

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply

Native only

Topic does not apply

Standard

Topic does not apply Topic does not apply

Native only

Topic does not apply

Pro and Team

Topic does not apply Topic does not apply

Native only

Topic does not apply

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

The ability to dynamically allocate and deallocate memory is one of the strongest features of C/C++ programming, but the greatest strength can also be the greatest weakness. This is certainly true of C/C++ applications, where memory-handling problems are among the most common bugs.

One of the most subtle and hard-to-detect bugs is the memory leakā€”the failure to properly deallocate memory that was previously allocated. A small memory leak that occurs only once may not be noticed, but programs that leak large amounts of memory, or leak progressively, may display symptoms ranging from poor (and gradually decreasing) performance to running out of memory completely. Worse, a leaking program may use up so much memory that it causes another program to fail, leaving the user with no clue to where the problem truly lies. In addition, even harmless memory leaks may be symptomatic of other problems.

Fortunately, the Visual Studio debugger and C run-time (CRT) libraries provide you with effective means for detecting and identifying memory leaks. To understand how to detect memory leaks using the CRT debugging facilities, read the following topics:

MFC provides its own set of facilities for detecting memory leaks in MFC programs. For more information, see Detecting Memory Leaks in MFC.

See Also

Concepts

Debugger Security

Other Resources

Debugging Native Code