Using Heap Watch

Windows 95 Only

Heap Watch (HW32) lets you view application heaps and monitor them for memory leaks. The Summary-view window shows a list of the heaps for all active Win32-based applications. The Details-view window shows all memory objects in the selected heap. The Object-view window shows the blocks of memory that were allocated for the given object.

The following is the command-line syntax for HW32:

hw32 [-la LogFile] [-lh Logfile] [-aa MS] [-ah MS]
 
-la LogFile
The name of the log file used to store heap information when you click Update from the Summary-view window.
-lh LogFile
The name of the log file used to store heap information when you click Update or Snapshot from the Detail-view window.
-aa MS
Summary-view window snapshot interval, in milliseconds.
-ah MS
Details-view window snapshot interval, in milliseconds.

HW32 is useful for viewing memory objects and watching for memory leaks, as shown in the following procedures:

    To View a Given Memory Object
  1. From the Summary-view window, double-click the heap you want to watch. This displays up the Details-view window.
  2. From the Details-view window, double-click the address in the heap that you with to view.
    To Watch For Memory Leaks
  1. From the Summary-view window, double-click the heap you want to watch. This displays the Details-view window.
  2. Perform the operation that you believe causes the memory leak.
  3. Click Snapshot from the Details-view window. The snapshot count is incremented. Allocations that occurred 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 are automatically placed at the top of the list