mcheck()

Включить проверку последовательности выделенной памяти

Прототип:

#include <malloc.h>
int mcheck( void (*abort_fn)( enum mcheck_status status ) );

Аргументы:

abort_fn
A pointer to the callback function to invoke when an inconsistency in the memory-allocation routines is found, or NULL if you want to use the default callback routine. 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

Описание:

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.


Note: Consistency checking isn't performed on blocks that you allocated before calling mcheck().

The level of checking provided depends on which version of the allocator you've linked the application with:


Note: You can call mcheck() only once in a program.

Возвращаемое значение:

-1
Checking is already enabled.
0
Checking wasn't already enabled.

Классификация:

ЗОСРВ «Нейтрино»

Точка остановки потока
Нет
Обработчик прерываний
Нет
Обработчик сигналов
Нет
В потоке
Да

Тематические ссылки:

mallopt(), mprobe()




Предыдущий раздел: Описание API системной библиотеки