Copyright: Copyright Micorsoft, 1995.


About Heap Watch

This utility is used to view Windows 95 Win32 application heaps and monitor them for memory leaks.  The interface has three levels to view the appropriate information.  The first level, the Summary-view window, shows a list of the heaps for all of the Win32 applications running in the system at that given time.  Next, the Details-view windows, shows all of the memory object in the selected heap.  Finally, the Object-view window, show the allocated memory block for the given object.  Memory leaks are searched for by taking snapshots from the Details-view windows, before and after a given operation is performed.  Memory objects that exist after the post operation snapshot are potential memory leaks and can be further investigated.


Using Heap Watch with the kernel debugger

If you are running debug Windows 95 under the wdeb386 debugger HW32 will display, on the debug terminal,  the function address that allocated the object.  If symbols for the allocator are loaded, type the ln command with the address of the allocator found by HW32 to display the symbol name.  Otherwise, use the linker generated .map file to locate the allocator.


Using command line options
Command line options

Log file options:

-la LOGFILENAME	The name of the log file used to dump summary heap info when the Update menu item is selected from the Summary-view window.
-lh LOGFILENAME	The name of the log file used to dump heap snapshot info when the Update or Snapshot menu item is selected from the Details-view window.
When either of these command line parameters have been selected, a description dialog will appear when snapshots are taken.  This gives the user the opportunity to enter a description that will be entered into the log file.

Automation options:

-aa MS	Auto-All snapshot interval in milliseconds. This option automatically takes a summary view snapshot at the given time interval.
-ah MS	Auto-Heap snapshot interval in milliseconds. This option automatically takes a details view snapshot at the given time interval.


Viewing memory objects
To view a given memory object

1. From the Summary-view window, Dbl-click on the process' heap you wish to watch. This gives you the Details-view window.

2. From the Details-view window, Dbl-click on the address in heap of the memory object you wish to view.


Watching for memory leaks
To watch for memory leaks

1.	From the Summary-view window, Dbl-click on the process' heap you wish to watch.  This gives you the Details-view window.

2.	Perform the operation where you are trying to find the memory leak.

3.	Select the Snapshot menu item from the Details-view window.  The snapshot count will be incremented.  Allocations that took place during this snapshot and still exist, are possible candidates for a memory leak.

4.	Look for allocated memory objects that belong only to the current snapshot. Objects that belong to the current snapshot will be automatically sorted to the top of the list.

- Repeat 2 through 4 as necessary.

- The Update menu option will take another snapshot of the heap and reset the snapshot count to one.