[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

General Programming Concepts:
Writing and Debugging Programs

Malloc Trace

Malloc Trace provides an optional extension to the malloc subsystem for use with the trace facility. Traces of the malloc, realloc, and free subroutines are recorded for use in problem determination and performance analysis.

Malloc Trace is not enabled by default, but can be enabled and configured prior to process startup through the MALLOCDEBUG environment variable.

Events Recorded by Malloc Trace

The tracehook IDs used for Malloc Trace are as follows:

When tracing is enabled for HKWD_LIB_MALL_COMMON, the input parameters, as well as return values for each call to malloc, realloc, and free subroutines are recorded in the trace subsystem. In addition to providing trace information about the malloc subsystem, Malloc Trace also performs checks of its internal data structures. If these structures have been corrupted, these checks will likely detect the corruption and provide temporal data, which is useful in problem determination.

When tracing is enabled for HKWD_LIB_MALL_INTERNAL and corruption is detected, information about the internal data structures are logged through the trace subsystem.

Enabling Malloc Trace

Malloc Trace is not enabled by default. It is enabled and configured by setting the MALLOCDEBUG environment variable. To enable Malloc Trace, set the MALLOCDEBUG environment variable by typing the following on the command line:

MALLOCDEBUG=trace

To enable other Malloc Debug features, set the MALLOCDEBUG environment variable as follows:

MALLOCDEBUG=[trace, other_option]

Malloc Trace can be used concurrently with the following malloc subsystem capabilities:

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]