Causing a trace and giving results
A program can cause a trace to be performed and memory leaks to be reported by calling the malloc_dump_unreferenced() function provided by the library:
int malloc_dump_unreferenced ( int fd, int detail );
Suspend all threads, clear the mark information for all heap buffers, perform the trace operation, and print a report of all memory leaks detected. All items are reported in memory order.
- fd
- The file descriptor on which the report should be produced.
- detail
- How the trace operation should deal with any heap corruption problems
it encounters:
- 1
- Any problems encountered can be treated as fatal errors. After the error encountered is printed, abort the program. No report is produced.
- 0
- Print case errors, and a report based on whatever heap information is recoverable.