Memcheck is the dynamic memory error detector tool present in Valgrind framework. It mainly helps detecting dynamic memory allocation-deallocation related error. This tool can be used for C / C++ codes.
Memcheck is the dynamic memory error checker tool present in the valgrind framework. It can detect dynamic memory usage related errors in c and c++ programs. Mainly, it shows the erroneous cases for the following scenarios
- Accessing memory you shouldn't, e.g. overrunning and underrunning heap blocks, overrunning the top of the stack, and accessing memory after it has been freed.
- Using undefined values, i.e. values that have not been initialised, or that have been derived from other undefined values.
- Incorrect freeing of heap memory, such as double-freeing heap
blocks, or mismatched use of
malloc
/new
/new[]
versusfree
/delete
/delete[]
. - Overlapping
src
anddst
pointers inmemcpy
and related functions. - Memory leaks.
While using valgrind freamework for testing a program, memcheck is the default tool to be used for checking. When memcheck finds any error in the program, it prints out the error type and possible location in the code, along with some other process related information which helps to find out the erroneous piece of code and fix it.
Any dynamic memory debugging done with memechek tool [or default valgrind tool] are to be marked with this tag.