Reference

libdebauch(3)

The Debauch Libary 0.1

NAME

debauch - The Debauch Libary 0.1

DESCRIPTION

Debauch is a malloc debugger. It is based on code from "memleak" from the XFree86 distribution (originally by Keith Packard of the MIT X Consortium), but has been significantly altered such that a name change seemed appropriate. The name debauch was chosen in contrast to a commercial memory debugger "purify".

Debauch's library replaces the C library allocator; providing malloc, free, realloc and calloc (sorry, no valloc).

VARIABLES

There are several global variables which alter the behavior of debauch. These values can be initialized from environment variables of the same name. The environment variables should be set to 1 or 0 to turn the behavior on or off, respectively.

DebauchWarnReferenced

Warn about free'd memory which is still referenced. Programs may accidentially refer to this memory later, but in most cases this is not a problem. The debauch shell script defaults to turning this off.

DebauchWarnUnreferenced

Warn about malloc'd memory to which there are no references, this may become "lost" memory (a memory leak). Since leaks will be reported at the end, the debauch shell script defaults to turning this off.

DebauchWarnMiddlePointers

Normally, memleak ignores pointers to the middle of freed memory. These are frequently simply random data which happens to look like a pointer. Turning this on will generate additional messages.

DebauchCheckAlways

When set, memleak checks the entire memory system after each allocation or free. This is very expensive, but may catch errors not otherwise found until too late.

Serial event tracing: These variables are more useful when running inside a debugger, or if the source to your program has been specially modified to use debauch. Debauch assigns a serial number to each malloc/free event and stores it in the allocation header. You can use this serial number to control Debauch's output.

DebauchAllocBreakpoint

At each allocation, Debauch increments a serial number and stores it in the allocation header. By rerunning the program, you can stop when that piece of memory is going to be allocated. Store the serial number in this global variable and put a debugger breakpoint inside AddActiveBlock at the indicated line

DebauchFreeBreakpoint

Similarly for freeing memory.

DebauchTime

The current serial number. (Not settable via an environment variable.)

DebauchErrorTime

This variable will cause debauch not to print error messages from malloc/free events before the specified time. You may wish to use this if your program does extensive allocation to initialize (e.g. an X11 program), which you're not concerned about. Within the running program (or via the debugger) you can set DebauchErrorTime=DebauchTime, and no events prior to the current counter will be printed when CheckMemroy is called or when the program exits. You may also initialize DebauchErrorTime from an environment variable of the same name.

USER-CALLABLE ROUTINES

extern int DebauchStart(void);

Client programs may call this routine to set error reporting to ignore memory allocated or freed before the current time. This requires the client program to be re-compiled. Alternately, this routine may be called from a debugger at a suitable time. Errors occuring *before* this routine are still recognized internally; but messages about them are supressed.

SEE ALSO

debauch(1) This Manpage is only for Debian GNU/Linux it is not included in the original sourcecode. The original documenation is locateted under "/usr/share/doc/debauch/".