Name

SM_HEAP_CHECK

Synopsis

The libsm library in the sendmail source distribution offers a way to provide memory leak detection and error checking that overlays the usual malloc(3), realloc(3), and free(3) C-language library routines. To disable extra checking, define SM_HEAP_CHECK as zero:

APPENDDEF(`confENVDEF', `-DSM_HEAP_CHECK=0')

If you choose to enable extra checking, it will not be turned on by default. Instead you will need to turn it on and off with special debugging command-line switches (we cover this soon). To enable extra checking, define SM_HEAP_CHECK as 1:

APPENDDEF(`confENVDEF', `-DSM_HEAP_CHECK=1')

Once extra checking has been included in your sendmail code, you can turn it on and off with debugging command-line switches. The category is sm_check_heap, and there are four meaningful levels:

# /usr/sbin/sendmail -dsm_check_heap.level ...

The four meaningful values for level are shown in Table 3-12.

Table 3-12. Debugging levels for memory validity checking

Level

Description

1

This level causes a table of all currently allocated blocks to be maintained. The table is used by the sendmail hooks sm_realloc( ) and sm_free( ) to perform validity checks on their first arguments.

2

With this level, a report will be printed just before sendmail exits. That report contains a single line listing the total storage allocation used in bytes.

3

With this level, a report will be printed just before sendmail exits. That report, in addition to the report given previously, will ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.