How memory leaks affect Windows PCs

TechRepublic
There are times when the Windows pagefile will grow out of control.

While the pagefile typically grows and fluctuates as the Windows system needs to move data from RAM to virtual memory, the pagefile doesn't usually become a problem unless a program has a memory leak. Then the program in question will hog too much RAM and cause the pagefile to become bloated. This can eventually lead to a variety of system performance issues.

In order to mitigate this problem, you need to pinpoint the offending program and shut it down.

The way to see what's happening with the pagefile is to utilise the Windows Performance Monitor. In Windows XP, the easiest way to access this tool is to go to Start | Run and type perfmon  and click OK.

Once Performance Monitor opens, click the + button. From the Performance Object drop-down list, select Memory. Select the All Counters radio button and then click the Add button and the Close button. Monitor this for a few hours. You can tweak the counters to remove some that don't seem necessary and you can leave it on in the background while you're looking for the program with the memory leak.

One way to find the specific offending program is to use the Task Manager. You can open the Task Manager with the keyboard combination [Ctrl][Shift][Esc]. Go to the Processes tab and look at the Mem Usage column to see if you have any memory hogs. You can also click View | Select Columns and add counters such as Page Faults, Page Faults Delta, and Virtual Memory Size to the Task Manager to help you in your search.

Another way to find programs with memory leaks is to go back into the Performance Monitor and click the + button to add counters. This time you can select Process as the Performance Object and use the options there to monitor variables for suspicious processes.

Once you think you've nailed down the program that's causing the problem, you can uninstall it, delete the executable, and/or disable it in the Windows Registry. (Perform registry edits with great caution!)

Submitted by eebywater, TimTheToolMan, and TheChas

TechRepublic is the online community and information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to firewalls, we offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.

©2004 TechRepublic, Inc.

Advertisement

Talkback 1 comments

    Some good tips in here for tho ...Anonymous -- 11/07/04

    Some good tips in here for those who are a bit handy with computers. I would like to point out a couple of things.

    Firstly, make sure you know what an application is before you decide to terminate it. If you don't know ask google, but seriously, some applications will tend to grow in memory requirements from first boot, but may eventually plateau. This is because memory isn't allocated to a program until an object is instantiated within the program.

    Memory leaks basically happen when the programmer forgets that they have a created object and that they need to free it. This can be due to either sloppy, rushed code where they clean forget, or due to some error occuring that the programmer did not anticipate, calling some exception handling routine instead of the code they wrote to clean up after them. Also note that when a program frees an object, windows doesn't jump into action and reclaim the memory the program was using. That would actually slow the computer down as it would have to fix up its memory allocation tables.

    Instead, windows leaves the memory assigned to the program, but notes that the program doesn't need it anymore. This accomplishes 2 things. First, if the program asks for more memory again, Windows just returns the memory addresses it had before (which is quicker than allocating it from scratch). Secondly, unallocating memory requires CPU time, which would be a waste if your computer still had available memory.

    In older versions of windows, when windows ran out of memory, it firstly did its housekeeping to reclaim the memory each program had freed up to try and regain enough to allocate. If there still wasn't enough, the virtual memory came into play. Newer versions are a bit more sensible when they come to the housekeeping and reclaiming memory. They do the housekeeping when the memory is getting low, rather than waiting until it needs the memory. It is like popping off to the shops when you have half a bottle of milk left, rather than waiting for someone to run out of milk half way through filling their cereal bowl.

    Sorry that was so long winded, I will make the other point quickly now. Memory leaks are not confined to windows PCs. Some languages make it harder to forget to free your objects, but we have a while to go before memory leaks are a thing of the past.

Sponsored content

Power Centre - Content from our premier sponsors

Blogs

  • Darren Greenwood Has New Zealand's smiling assassin delivered?
    One year into its tenure, how has the new New Zealand Government performed on issues of technology and telecommunications?
  • Array The long-awaited separation of Telstra
    Blessed is he who shepherds the weak through the valley of Telstra, for he is truly his brother's keeper and the finder of lost DSLAMs.
  • Array Has Particls disintegrated?
    Brisbane-born start-up Particls promised a better way of organising information from the web. Now, however, it appears to have given up the battle, with both the Particls website and that of its parent company Faraday Media disappearing from the web.
  • More blogs »

Tags

Back to top

Featured