You are on page 1of 12

How to Detect a Memory Leak By Using System Performance Monitor in Windows 2000

Overview
   

 

What is a memory leak? Establish a baseline to detect memory leaks Different types of memory/resources Which counters to select to detect memory leaks in System Performance Monitor Examples of memory leaks What to do when you find a memory leak

What Is a Memory Leak?




A memory leak occurs when a program uses resources on a computer but never releases the resources. The resources can include handles, physical RAM, the paging file, system resources, etc. Symptoms of a memory leak include system hangs, slow system performance, and program memory error messages.

Establish a Baseline


Before trying to detect a memory leak, gather a log on a computer that has the same role, hardware, and basic programs to determine a baseline for each process. Each process has a set of code that allocates resources uniquely. When a process starts, resource allocation can increase rapidly. However, resource allocation should level off after a period of time. To establish a memory leak, resource allocation for that process should continue to increase on a very consistent basis over a period of time. See article Q240389 in the Microsoft Knowledge Base to set up a performance log.

Different Types of Resources




Private bytes resources the process has allocated that cannot be shared with other processes. Pool page bytes an area of system memory (physical memory used by Windows 2000) for objects that can be written to disk when they are not being used.

Different Types of Resources




Pool non-page bytes an area of system memory for nonobjects that cannot be written to disk but which must remain in physical memory. (The limit is 256 MB). Pool page bytes/pool non-page bytes are areas of nonsystem memory set aside by Windows 2000 for system components. Handles are the sum of the number of file handles that are owned by each thread in the process.

Counters to Detect Memory Leak

Under the memory object, click the Available Bytes counter.

Counters to Detect Memory Leak

Under the process object, click the Handle Count, Pool Nonpaged Bytes, Pool Paged Bytes, and Private Bytes counters for the process that may be having the problem.

Chart View of Performance Monitor

Displays the selected counters: Available Bytes, Handle Count, Pool Nonpaged Bytes, Pool Paged Bytes, and Private Bytes.

Example of Private Byte Memory Leak

In this example, the Private Bytes count for the process is consistently increasing. It never decreases, indicating that the BugBug process has a memory leak.

Example of Handle Count Memory Leak

In this example, the Handle count for the process is consistently increasing. It never decreases, indicating that the BugBug process has a memory leak.

What to Do When You Find a Memory Leak


 

Stop any service related to that process. Stop any process that may interact with the process with a memory leak. If the process is part of a third-party program, thirdcontact the manufacturer for any updates to the program. If it is a Microsoft process or program, check the Microsoft Knowledge Base for any known issues. If there are no known issues with the Microsoft process or program, contact Microsoft Product Support Services.

You might also like