Commentary
1/7/2004
02:56 PM
Fred Langa
Fred Langa
Commentary

The Explorer: Resource Leaks, Part Four: Final Fixes

Once you've plugged the leaks, take the time to fine-tune your setup.



In Part One of this series, we discussed the how and why of "resource leaks;" what they are, the problems they can cause, and how you can determine if your system is suffering from them. To refresh your memory, resource leaks typically involve two special, fixed-size areas of Windows memory (how much RAM you have is irrelevant); in poorly coded software applications, some of the memory used by an app may not be released when the app closes -- or crashes. Over time, more and more resources may be marked as "in use" even when they're really not. Eventually, there's not enough space available in these two special memory areas to continue working (again, regardless of how much total RAM you have), and you get an "out of memory" error message or crash.

In Resource Leaks, Part Two, I detailed the inner workings of a variety of tools and utilities that claim to solve memory leaks. Along with explaining the pros and cons of "opening holes in RAM," "RAM defragmentation," and related issues, Part Two tells you why these apps can be worthless or even counterproductive. But it does detail one limited and specific use of one particular freeware utility that I feel is worthwhile.

After Part Two appeared, I also covered some ancillary information in my newsletter. In a recent issue of my LangaList, for example, I explained why Windows has memory limits in the first place.

In Resource Leaks, Part Three, I explained a five-part strategy I use that just may let you solve your memory leak problems once and for all -- or, barring that, perhaps reduce their severity to a negligible level. It focuses on the way Windows' various memory subsystems work together -- the swapfile, Vcache, and so on. Part Three is the heart of this series, so if you missed it or haven't yet tuned your system, your best bet is to go back and get tweaking. Once you're done, you'll have a system that's probably far more stable than what you now have.

When the worst leaks and memory problems are resolved or reduced, there are additional fine-tuning steps you can take to refine your setup and preserve its newfound stability. These steps are an extension of Part Three: by perfecting the rest of your Windows setup, you can reduce or eliminate "ripple effect" problems that can cascade from one area to another. These final steps, in fact, can help make up the remaining differences between systems that can run for long periods without resource or memory problems, and ones that can only run for periods of time ranging from a couple days down to just a few hours!

Here's what's involved. As with Part Three, it's not hard, but it touches on many areas, so fasten your seatbelts -- we're again going to be moving fast!

Heavy-Duty Nightly (Automatic) Maintenance
I use a modified version of the "Scheduled Tasks" as set up by the Win98 Maintenance Wizard. You can access the Wizard by typing Tuneup in the Start/Run box, or by clicking on C:\windows\tuneup.exe, or by clicking to Start/Programs/Accessories/System Tools/Maintenance Wizard.

I use the "Custom" configuration option, and manually select and adjust each item. On its own, the Wizard will offer to preferentially position some files at the start of your hard drive ("Start Windows More Quickly"), Defrag ("Speed Up Programs"), ScanDisk ("Scan Hard Disk For Errors"), and Disk Cleanup ("Delete Unnecessary Files"). On some systems, the Wizard may also set up Walign. (See Resource Leaks, Part Three.)

Once it's set up, the Task Scheduler icon will appear in your system Tray, near the clock. (Except in Windows Millennium Edition [WindowsMe] -- but we'll deal with that in a future column.) If you double click on the Task Scheduler icon, you'll see all scheduled tasks and, by right clicking on any task and selecting its Properties, you can further refine and adjust its settings. You also can prevent any scheduled task from running via the "Enable" checkbox in each item's Properties sheet; or can add new scheduled items -- you can run any program automatically -- via the Add Scheduled Task icon.

For example, I prefer Norton's Speed Disk to Windows' Defrag -- the Norton version is much faster and affords more options. I've disabled Defrag in my Scheduled Tasks, and added Speed Disk in its place. Likewise, I prefer Norton's Disk Doctor to Scandisk; I've disabled the latter, and added the former.

I also used the Add Scheduled Task option to perform an intense virus scan of very file on all my hard drives, every night; in addition to my normal precautions during the day, this deep scan ensures that I'm safe from even subtle viri, Trojans and worms that may have crept past my main defenses.

I've adjusted the timing of each maintenance step to ensure that each tool has plenty of time to finish before the next one starts (to prevent, say, contention for the hard drive). Each night while I sleep, my PC does the following: First, my antivirus app runs (this takes a while because I have many, many files). Later, Disk Doctor (Scandisk) kick in and automatically repairs any disk or file system errors it finds. Disk Cleanup runs next, tossing out unneeded "Temporary Internet Files," and "Temp Files," emptying the Recycle Bin, and so on. Then, once the disk is clean, virus-free and error-free, Speed Disk (Defrag) does its thing, moving my most-used files to the front of my drive for fastest access, and making all files smoothly contiguous.

Once a week, very early each Monday morning, I also have a custom batch file run just after the standard Disk Cleanup runs. The custom batch file more aggressively cleans out any, er, garbage that accumulated during the previous week. Here are the contents of the batch file:

deltree /y c:\windows\temp
del c:\windows\tempor~1\*.zip
del c:\windows\tempor~1\*.exe
del c:\windows\tempor~1\*.gif
del c:\windows\tempor~1\*.jpg
del c:\windows\tempor~1\*.png
del c:\windows\tempor~1\*.bmp

I placed the batch file in my C:\ drive, and used the Add Scheduled Task function to insert it into the scheduled task list. I've also scheduled WMalign (mentioned in Part Three of this Resource Leaks series) to run once a month; WMalign, is a better version of Walign.

And when I reboot (such as after making a full, daily system backup using DriveImage), my autoexec.bat file also does a little extra cleanup. It includes lines that help weed out miscellaneous junk that accumulates in the Windows folder, and trims a cache that can eat some resources unnecessarily:

del c:\windows\ff*.tmp
if exist C:\WINDOWS\SHELLICO C:\WINDOWS\COMMAND\ATTRIB C:\WINDOWS\SHELLICO -r -h -s
if exist C:\WINDOWS\SHELLICO del C:\WINDOWS\SHELLICO

Note that all this takes place unattended and completely automatically, with zero effort on my part: Each day, I start with a system that's virus free, error-free, defragged and that's had all its garbage collected and thrown out.

Along with all the resource/memory optimizations mentioned in Parts One-Three, my system starts each day as solid as I can make it. This helps prevent small problems from accumulating over time, and contributes to overall stability.

Manual and Preventive Maintenance
In addition to the effortless, nightly, automated maintenance, I also perform some manual maintenance on as as-needed basis. I'll run RAMpage, for example, after an applications crash (see Resource Leaks, Part Two for more info).

All the above greatly enhances the stability of my system, as-is; but what about system changes? Installing new software, for example, is one of the greatest instability-makers, and can really rock your boat. To help avoid problems with new apps, I always run Norton Windows Doctor/System Check both immediately before and after a major software install or upgrade to find and fix any installation problems before they can cause a domino effect of cascading failures. (I also run Windows Doctor/System Check on an ad hoc basis whenever I sense something may not be quite right with my system.) I also manually backup my Registry just before installing new software to simplify uninstalling, should I need to do so.

Results
Written out this way, the list of maintenance items seems daunting -- but note that almost all the above items only need to be set up once: Then, they run entirely on their own.

And once it's properly set up and maintained, your system will almost surely be far more stable than otherwise. As I've mentioned in the past, I can run my PCs for almost arbitrarily long periods without system crashes, and can drive my System Resources down into the single digits without experiencing any instability. Chances are, you can, too, if you follow the steps outlined in this Four Part series.

Or, you may have other suggestions: You may know other apps that you've found useful, or other tricks you've discovered that enhance stability. Please share them! Join in the discussion and tell us the results of your efforts in this four-part series, and of any other helpful information you've found. Let's pool our knowledge!


To discuss this column with other readers, please visit Fred Langa's forum on the Listening Post.

To find out more about Fred Langa, please visit his page on the Listening Post.

We welcome your comments on this topic on our social media channels, or [contact us directly] with questions about the site.
Comment  | 
Email This  | 
Print  | 
RSS
More Insights
Copyright © 2020 UBM Electronics, A UBM company, All rights reserved. Privacy Policy | Terms of Service