Dmalloc Logo


Search this site:

If dmalloc has saved you or your company time or money, please use your credit-card or PayPal account to donate to the cause.

Dmalloc Tutorial: 4.4 Description of the Debugging Tokens
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4 Description of the Debugging Tokens

The below tokens and their corresponding descriptions are for the setting of the debug library setting in the environment variable. See section Environment Variable Name and Features. They should be specified in the user's `.dmallocrc' file. See section Format of the Runtime Configuration File.

Each token, when specified, enables a specific debugging feature. For instance, if you have the log-stats token enabled, the library will log general statistics to the logfile.

To get this information on the fly, use dmalloc -DV. This will print out the Debug tokens in Very-verbose mode. See section Dmalloc Utility Program.


No debugging functionality


Log general statistics when dmalloc_shutdown or dmalloc_log_stats is called.


Log non-freed memory pointers when dmalloc_shutdown or dmalloc_log_unfreed is called.


Log only known memory pointers that have not been freed. Pointers which do not have file/line or return-address information will not be logged.


Log general memory transactions (quite verbose).


Log administrative information (quite verbose).


Log actual bytes in and around bad pointers.


Log actual bytes in non-freed pointers.


Log elapsed-time for allocated pointers (see `conf.h').


Log current-time for allocated pointers (see `conf.h').


Check fence-post memory areas.


Verify heap administrative structure.


Check to see if space that was blanked when a pointer was allocated or when it was freed has been overwritten. If this is enabled then it will enable free-blank and alloc-blank automatically.


Check the arguments of some functions (mostly string operations) looking for bad pointers.


Check all of the pointers in the heap when the program exits.


Shutdown the library automatically on SIGHUP, SIGINT, or SIGTERM. This will cause the library to dump its statistics (if requested) when you press control-c on the program (for example).


Always copy data to a new pointer when realloc.


Write special "dmalloc-free" byte (hexadecimal 0xdf, octal 0337, decimal 223) into space when it is freed. You can set this to be something else in the `settings.dist' file. This ensures that your program is not using memory after it has been freed. You can check to see if areas have been improperly overwritten with the check-blank token. If the free space has been overwritten, then ERROR_FREE_OVERWRITTEN is triggered. See section Description of the Internal Error Codes.


Abort the program (and dump core) on errors. See error-dump below.


Write special "dmalloc-alloc" byte (hexadecimal 0xda, octal 0332, decimal 218) into space when it is allocated. You can set this to be something else in the `settings.dist' file. If you are not using calloc this will overwrite the user space with the special bytes ensuring that your program is initializing its dynamic memory appropriately. Also, if you ask for 35 bytes and the library has to give you a block of 64 because of rounding issues, it will overwrite the extra memory with the special byte. You can then check to see if the extra areas have been improperly overwritten by enabling the check-blank token.


Log any errors and messages to the screen via standard-error.


Abort the program immediately if the library fails to get more heap space from the heap allocation routine mmap or sbrk.


Have the heap never use space that has been used before and freed. See section Tracking Down Non-Freed Memory. WARNING: This should be used with caution since you may run out of heap space.


Dump core on error and then continue. Later core dumps overwrite earlier ones if the program encounters more than one error. See error-abort above.

NOTE: This will only work if your system supports the fork system call and the configuration utility was able to fork without going recursive.


By default the library will not generate an error when a program tries to free a NULL pointer. By enabling this token, you can change this behavior so an error is reported. See also the ALLOW_FREE_NULL and ALLOW_FREE_NULL_MESSAGE settings in the `settings.h' file to change the default behavior.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Gray Watson on May, 16 2007 using texi2html 1.76.

This work is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.
This page should be W3C Valid XHTML and should work with most browsers.