Contents
Windows Resource Monitor

ResMonitor lets you monitor some of the memory resources in the Microsoft Windows 3.1 environment including:

Overall free system resources

Percentage and amount of free resources for the Windows User module

Percentage and amount of free resources for the Windows GDI module

Percentage and amount of free memory--including swap file memory.

Resource Monitor is designed for both users and programmers.  Users can use Resource Monitor to keep track of system resources and set alarms for when Windows system resources drop below specific levels.  Programmers will find Resource Monitor much easier to use than HEAPWALK to test their program for "leaking" Windows system resources.

The following Help Topics are available:

Resource Monitor 1.01 Release Notes

Resource Monitor Requirements

Resource Monitor Icon

Resource Monitor System Menu

Resource Monitor Setup Dialog Box

What are system resources and what does Resource Monitor do?

Tips for programmers

RMONITOR.INI


What are system resources and what does ResMonitor do?

Resource Monitor was developed to help you keep track of Windows resources:  the available space in the User heap, the available space in the GDI heap, and free Global memory.  The resource monitor icon displays which system resource is the most critical--User or GDI.  You can also configure Resource Monitor using the Setup dialog box to display information about system resources in the Resource Monitor window caption.

If you double-click on the resource monitor window, it opens to display all the Windows system resource information it monitors as shown below:

As you can see, the Resource Monitor window displays:

Three colored bars (green , yellow , and red ) that show the percentage of free system resources for User, GDI, and free memory.

Resource Monitor SnapShots .

Size of Free and Total memory--including swap file memory.

User and GDI segment sizes.


Resource Monitor Icon

When you start Resource Monitor for the first time, an icon appears that is a colored bar gauge that displays the amount of critical system resources.  The Resource Monitor bar gauge uses three different colors:


Resource Monitor System Menu

Resource Monitor has the following menu commands in the Resource Monitor system menu:

Monitor Both GDI and User.  This is the default setting when you execute Resource Monitor for the first time.  When this menu item is selected, Resource Monitor measures both the User and GDI Windows modules and displays the free resources for the most critical one using the Resource Monitor icon.

Monitor GDI.  When this menu item is selected and checked, the Resource Monitor icon only displays information for the GDI Windows module.

Monitor User.  When this menu item is selected and checked, the Resource Monitor icon only displays information for the User Windows module.

Take SnapShot records the size of both the User and GDI free system resources.  You can see the amount of change in the system resources by opening the Resource Monitor Window or adding the SnapShot information to the Resource Monitor window caption using the Setup dialog box.

Resource Monitor Setup displays the Setup dialog box to let you configure the information displayed in the Resource Monitor window caption and to set Resource Monitor alarms

Always On Top puts the Resource Monitor icon or window on top of all other windows so it can always be viewed.

Help for Help displays help for using Windows Help.

Help for Resource Monitor displays help for the Resource Monitor program.

About Resource Monitor displays the About Resource Monitor dialog box.


Resource Monitor Setup Dialog Box

The Resource Monitor Setup dialog box lets you configure the information in the Resource Monitor window caption and set Resource Monitor alarms.  The Setup dialog box appears as shown below:

Setting window caption options

For Resource Monitor to work effectively, you should choose Desktop in the Windows Control Panel and select the  Wrap Title option--if you haven't already.  This is the default when Windows is installed.  Window captions cannot exceed approx. 60 characters, so DON'T TURN ON EVERY RESOURCE MONITOR WINDOW CAPTION OPTION.  Monitor only what's needed.  Unless I am debugging a program, I don't usually monitor anything in the window caption or just monitor the Percent free for GDI and User.  If you want to monitor as much as you can in the window caption, remember you can turn off the Program Title--this gives you additional space.

Setting alarms

Alarms are one of Resource Monitor's handiest features.  They will alert you when your system resource are critical.  I set mine at 40% for both GDI and User.  When an Alarm goes off, Resource Monitor drops the Alarm's setting by 10% to keep it from going off again in the near future.  You need to reset the Alarm to its previous setting after your system resources have climbed back to an acceptable level.  If an alarm is set at 0, it's ignored by Resource Monitor.  In other words, 0 means the Alarm is OFF.

Sampling Rate

Sampling rate lets you configure how often Resource Monitor checks system resources in seconds.  The acceptable range is from 1 to 600 seconds.


Tips for programmers

Resource monitor is designed as a Windows system resource monitor for programmers to use for testing their programs to find out if their programs are "leaking" system resources.  To test your program for leaking system resources, do the following steps:

1.	Start Resource Monitor.

2.	Choose Always On Top from the Resource Monitor system menu so Resource Monitor is always visible.

3.	Choose Setup Resource Monitor from the Resource Monitor system menu to display the Resource Monitor Setup dialog box.

4.	Select User segment SnapShot and GDI segment SnapShot to display SnapShot information in the window caption of the Resource Monitor icon.  Then choose OK.

5.	Run and test your application.  Make sure that you ar only running your application during this test.  Running other Windows applications while you are testing your application can throw test results off significantly.

6.	Close your application.  If the amount of SnapShot system resources displayed by Resource Monitor is not zero, you may have a resource leakage problem.

If Resource Monitor reports a problem, you should check your program code to see if your Windows application is releasing Windows system resources correctly.  Chapter 6 of Advanced Tools for Windows Programmers, published by Sybex, describes the types of Windows system resources that can cause this problem.  Chapter 10 of Advanced Tools for Windows Developers describes how to use the Debugging version of Windows to help you track down this problem in your program code..


critical system resources

Resource Monitor measures the amount of free system resources for both GDI and User.  When you start Resource Monitor for the first time, it monitors both User and GDI, and displays the free system resources for the most critical (lowest amount of free resources) Windows module.  You can override this option by changing the way Resource Monitor displays its icon in the System menu.


Green Resource Monitor Icon
Green Bar

A green lets you know that there are adequate system resources available (above 60%) for GDI and User.


Red Resource Monitor Icon
Red Bar

A red bar indicates ALERT to let you know that the system resources have become critical (below 40%) for GDI or User.


Yellow Resource Monitor Icon
Yellow Bar

A yellow bar indicates caution to let you know that the system resources are becoming more limited (between 60% and 40%) for GDI or User.


Resource Alarm

You can set a resource alarm using the Resource Monitor dialog box.  Resource alarms can be set for User percentage of free resources, GDI percentage of free resources, and free system memory.  After you have set a resource alarm, a system modal dialog box appears when the system resource for the alarm drops below the specified level.


SnapShot

A SnapShot records the size of both the User and GDI free system resources.  You can see the amount of change in the system resources by opening the Resource Monitor Window or adding the SnapShot information to the Resource Monitor window caption using the Setup dialog box.


Resource Monitor 1.01 Release Notes

Dynamic Link Libraries

Resource Monitor requires two DLLs: Microsoft's TOOLHELP.DLL and Borland's BWCC.DLL.  I have included the Borland DLL in the ZIP file.  You need to have the Microsoft TOOLHELP DLL already on your system.  It comes with Microsoft Windows 3.1 .

Window Captions

For Resource Monitor to work effectively, you should choose Desktop in the Windows Control Panel and select the  Wrap Title option--if you haven't already.  This is the default when Windows is installed.  Window captions cannot exceed approx. 60 characters, so DON'T TURN ON EVERY RESOURCE MONITOR WINDOW CAPTION OPTION.  Monitor only what needed.  Unless I am debugging a program, I usually don't monitor anything in the window caption or just monitor the Percent free for GDI and User.  If you want to monitor as much as you can in the window caption, remember you can turn off the Program Title this will give you additional space.

RMONITOR.INI

Resource Monitor does create a private INI file, RMONITOR.INI, in your Window directory to remember your selections from execution to execution.  You do not need to edit this file.  It exists and if you get rid of Resource Monitor, you will want to delete this file as well.

Alarms

Alarms are one of Resource Monitor's handiest features.  They alert you when your system resource are critical.  I have mine set for 40% for both GDI and Use.  When an Alarm goes off, Resource Monitor drops the Alarm's setting by 10% to keep it from going off again in the near future.  You need to reset the Alarm to its previous setting after your system resources have climbed back to an acceptable level.  If an alarm is set at 0, it's ignored by Resource Monitor.  In other words, 0 means the Alarm is OFF.

Bugs Fixed in 1.01.

UAE when you make too many selections for window caption in setup.

Remembering SnapShots between program executions.

New Feature

You ask for it, you get it.  Resource Monitor now supports user configurable sampling rates between one and six hundred seconds.


Resource Monitor Requirements

Resource Monitor requires Windows 3.1 or later!

Resource Monitor also requires two DLLs: Microsoft's TOOLHELP.DLL and Borland's BWCC.DLL.  I have included the Borland DLL in the RMONITOR.ZIP file.  You need to have the Microsoft TOOLHELP DLL already on your system.  It comes with Microsoft Windows 3.1.


RMONITOR.INI

Resource Monitor creates a private INI file, RMONITOR.INI, in your Window directory to remember your selections from execution to execution.  You do not need to edit this file.  It exists and if you get rid of Resource Monitor, you will want to delete this file as well.