next up previous contents index
Next: 19.1.3 External Dependencies Up: 19.1 Introduction Previous: 19.1.1 Memdebug Library Configuration

19.1.2 Memdebug Library Internals

The default malloc and the provided memdebug_alloc can have different policies. memdebug_alloc uses the LMM library directly to provide memory, in the same way as the default libc malloc. But malloc can be replaced, and memdebug_alloc will not change.

When allocating memory on small alignment boundaries, those boundaries will actually be bumped up to the alignment necessary for the leading fence-post of the allocation. Thus, when running under memdebug data may be aligned at a larger granularity than when running without memdebug.

All of the routines use memdebug_printf to print all output. This function should always be defined such that it guarantees that it will never cause any memory to be allocated. You should override this if you cannot guarantee that vfprintf calls will not allocate memory.

The allocation management routines all call mem_lock and mem_unlock to protect access to the global malloc_lmm. See the minimal C library's section on Memory Allocation (Section 9.5) for more information on these functions.



University of Utah Flux Research Group