Penguin
Annotated edit history of mcheck version 3, including all changes. View license author blame.
Rev Author # Line
1 JohnMcPherson 1 The gnu c library (glibc 2 a.k.a linux libc6) has a couple of helpful features for finding memory allocation/usage problems, including uninitialised and unfreed memory. In your [C] program (and [C++]?):
2
3 #include <mcheck.h>
4 ...
5 main(int, char**) {
6 mtrace();
7 ...
8
9 include the mcheck.h header file in all your .c files, and call mtrace as the first statement in main.
10
11 then:
12 $ export MALLOC_TRACE=<outputfilename>
13 $ <runprog>
14 $ mtrace <prog> <outputfilename>
2 MartinGadbois 15
3 MartinGadbois 16 Do not use mcheck() and malloc_usable_size() at the same time, as mcheck() changes the implementation of malloc(), and malloc_usable_size() looks for the size at the wrong place.
1 JohnMcPherson 17
18 ----
2 MartinGadbois 19 See also [LD_DEBUG], [MALLOC_CHECK_], [http://www.gnu.org/manual/glibc-2.0.6/html_node/libc_30.html]
The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors.
  • MartinGadbois
The following authors of this page have agreed to the WlugWikiLicense.

PHP Warning

lib/plugin/WlugLicense.php (In template 'html'):99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php (In template 'html'):111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument

lib/plugin/WlugLicense.php (In template 'html'):111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument