Debugging Dynamic Memory Usage Errors Using HP WDB (766161-001, March 2014)

Parameters:
RTC_LEAK_ALL (0) - Prints all current memory leaks.
RTC_LEAK_NEW (1) - Prints an incremental report for all new leaks (leaks introduced since
the last call to the function rtc_leaks())
Return values:
0 indicates no new leaks.
A non-zero positive value indicates the total number of all or new leaks.
-1 indicates error and error will be printed to STDERR or log file set.
int rtc_heap (void)
Use this API to get all heap information in the running process. The report is printed on the STDOUT
or redirected to a user specified logfile.
Return values:
0 indicates no heap blocks.
A non-zero positive value indicates the total number of allocated heap blocks.
-1 indicates error and error will be printed to STDERR or log file set.
int rtc_heap_corruption (void)
Use this API to get all heap block corruptions in the running process. The report is printed on the
STDOUT or redirected to a user specified logfile.
Return values:
0 indicates no heap blocks corrupted.
A non-zero positive value indicates the total number of corrupted heap blocks.
-1 indicates error and error will be printed to STDERR or log file set.
int rtc_enable (int which_check);int rtc_disable (int which_check)
These are RTC tunable APIs.
Use rtc_enable() API to enable certain heap checks.
Use rtc_disable() API to disable certain heap checks.
The parameter “which_check” can be one of the following values:
RTC_CHECK_LEAKS (1) - To enable/ disable leak detection.
RTC_CHECK_HEAP (2) - To enable/ disable heap profiling.
RTC_CHECK_BOUNDS (4) – To enable/ disable bounds checking feature for detection of
heap-corruption.
RTC_CHECK_FREE (8) - To enable/ disable detect double-frees and frees with improper
arguments.
RTC_CHECK_STRING (16) - To enable/ disable validation of calls to strcpy(),
strncpy(), memcpy(), memccpy(),memset(), memmove(), bzero(), and,
bcopy().
RTC_CHECK_ALL (31) – To enable/ disable all the above checks.
Return values:
0 indicates success.
-1 indicates error and error string will be printed to STDERR.
64