heapdebug

Option Type Default Value #pragma options C C++
-qoption noheapdebug val x x

Syntax

    -qheapdebug

Purpose
Enables debug versions of memory management functions.

Notes
The -qheapdebug options specifies that the debug versions of memory management functions (_debug_calloc, _debug_malloc, new, etc.) be used in place of regular memory management functions. This option defines the __DEBUG_ALLOC__ macro.

When you specify -qheapdebug, the compiler generates additional code at the beginning of every function that preinitializes the local variables for the function. This makes it easier to find uninitialized local variables.

By default, the compiler uses the regular memory management functions (calloc, malloc, new, etc.) and does not preinitialize their local storage.

Example
To compile myprogram.c with the debug versions of memory management functions, enter:

xlC -qheapdebug myprogram.c -o testing 


Debugging Memory Heaps
Memory Management Functions
Managing Memory with Multiple Memory Heaps


Debugging Problems with Heap Memory


List of Compiler Options and Their Defaults
Options that Specify Debugging Features
_debug_calloc - Allocate and Initialize Memory
_debug_free - Free Allocated Memory
_debug_heapmin - Free Unused Memory in the Default Heap
_debug_malloc - Allocate Memory
_debug_memcpy - Copy Bytes
_debug_memmove - Copy Bytes
_debug_memset - Set Bytes to Value
_debug_realloc - Reallocate Memory Block
_debug_strcat - Concatenate Strings
_debug_strcpy - Copy Strings
_debug_strncat - Concatenate Strings
_debug_strncpy - Copy Strings
_debug_strnset - Set Characters in String
_debug_strset - Set Characters in String
_debug_ucalloc - Reserve and Initialize Memory from User Heap
_debug_uheapmin - Free Unused Memory in User Heap
_debug_umalloc - Reserve Memory Block from User Heap