Using env to Insert the HIA

The Heap Interposition Agent (HIA ) library path can be hard to determine. Use this CLI command to print its path:
puts $TV::hia_local_dir

When TotalView attaches to a process that is already running, the HIA must already be associated with it. You can do this in two ways:

  • Manually link the HIA as described in previous sections.

  • Start the program using env (see man env on your system). This pushes the HIA into your program.

Preloading cannot be used with Cray. For information on preloading with Cray, see Linking Your Application with the HIA.

The following table lists the variables required by each platform. The placeholder <hia_dir> represents the directory in which the HIA is found.

Table 26. Variables by Platform for Preloading the HIA

Platform

Variable

Apple Mac OS X

DYLD_INSERT_LIBRARIES=<hia_dir>/libtvheap.dylib
Note: See Mac OS for detail on how this environment variable works.

IBM AIX

MALLOCTYPE=user:tvheap_mr.a
If you are already using MALLOCTYPE for another purpose, reassign its value to the variable TVHEAP_MALLOCTYPE and assign MALLOCTYPE as above; when the HIA starts it will correctly pass on the options.

Linux

32-bit

LD_PRELOAD=<hia_dir>/libtvheap.so

64-bit

LD_PRELOAD=<hia_dir>/libtvheap_64.so