Memory Debugging using Totalview on HPCx

The latest version of Totalview on HPCx integrates a memory debugging feature.
This can be used to monitor memory usage in both Fortan and C codes and can be
helpful in identifying memory leaks in users' programs. AIX applications
differ from applications running on other platforms as AIX does not support
interposition . This means that HPCx users must recompile their
codes in order to link in the Totalview heap replacement library. Please
read the general instructions for running Totalview
here
before attempting to follow the memory debugging instructions below.

Instructions for using memory debugging features of Totalview

( In the following list, the instruction 'click' refers to left mouse button click .)

Ensure that the -g compiler flag is set to enable source line debugging and add the following
linker options for 32-bit executables:

For Serial Jobs:

Click Tools->Memory Debugging to open the Memory Debugging Window
of Totalview.

In the main window, set a breakpoint (left mouse click on line number) where you
wish to stop your source code.

Click Go

Click 'Enable memory debugging' in the Memory Debugging window.

Memory Debugging is now enabled for this process. For example, to generate a view of the Heap
Status click the Heap Status tab and then click Generate View.

For Parallel Jobs:

Start an interactive loadleveler session as usual (e.g.) :

user@l1f01$ runtv intmpihello.ll mpihello

Enter your password if required.
The Loadleveler GUI should appear on your display.

Click Tools->Memory Debugging to open the Memory Debugging Window
of Totalview.
Do NOT click the 'Enable memory debugging' button at this point (this would
attempt to debug the poe program that launches parallel programs
rather than the parallel program itself).

To connect to your own application you should click the Go button
and answer Yes when asked whether you wish to stop poe.
Your source code should now appear in the main Totalview Window and
a list of your parallel processes should now appear within the
Process Set area of the Memory Debugging Window.

In the main window, set a breakpoint (left mouse click) or barrier
(right mouse click) on one of the line numbers near the start of your source code.
Click Go to start the program running. The program should stop
at the breakpoint. (Due to asynchronicity of processes this may require
more than one click of Go).

In the Process Set list of the Memory Debugging Window
left click on one of your parallel processes. Memory debugging information is now
available. For example, to generate a view of the Heap Status click on the
process you wish to inspect, Go to an appropriate breakpoint,
then click the Heap Status tab and then click Generate View.

N.B. The Memory Debugging Window does not automatically
refresh when switching between processes. To update the Memory Debugging
window after switching processors click Window->Update .

More detailed information on the memory debugging features of Totalview
can be found in the documentation provided at the
etnus website