Enable memory allocation routine consistency checks
#include <malloc.h> int mcheck( void (* abort_fn)(enum mcheck_status status));
The argument to the callback routine is one of the values of the mcheck_status enumeration described in the documentation for mprobe().
The default abort callback prints a message to stderr and aborts the application.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mcheck() function enables consistency checks within the memory allocation routines. When enabled, consistency checks are periodically performed on allocated memory blocks as blocks are allocated or freed. If an inconsistency is found, the abort callback is called with the status identifying the type of inconsistency found.
The level of checking provided depends on which version of the allocator you've linked the application with:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |