Memcheck - Memory Checker
This is the source distribution of memcheck, Memory Allocation Checker.
To find out what's new in memcheck, see the file `NEWS'.
To find out how to build memcheck, consult the file `INSTALL'.
- For further information, consult the following files:
- AUTHORS List of contributing authors.
- COPYING The memcheck license.
- INSTALL How to build and install memcheck.
- NEWS Release information and recent changes.
- README This file.
- What:
- Fault on pointer overrun (read or write).
- Fault on freed pointer dereference (read or write).
- Log double free or realloc of already freed pointer.
- Log memory not freed on exit.
- Check for pointer underrun on free/realloc.
- Set level of logging.
- Optionally reverse behaviour of overrun and underrun.
- Optionally "churn" reallocations. Always return a different pointer.
- Optionally log pointer overruns instead of faulting.
- Optionally return freed memory to system.
(May hurt checking for freed pointer usage).
- Optionally log "large" allocations.
- Optionally run out-of-memory after a specified amount of memory has been used.
- Very small performance impact.
- Large memory footprint impact.
- Where:
- http://hald.dnsalias.net/projects/memcheck/
- Who:
- Hal Duston hald@kc.rr.com
- How:
- Building:
- ./configure
- make
- make check
- make install
- Using:
- On systems using GCC, bash, glibc:
- For source compilation, you can add `-include memcheck.h' to CPPFLAGS.
- For binaries, you can add `libmemcheck.so' to LD_PRELOAD
- On other systems:
You will need to recompile after adding #include "memcheck.h" to the source,
and `-lmemcheck' to LDFLAGS.
- MEMCHECK environment variable:
- comma seperated values place in the MEMCHECK environment variable.
- options with values are set with an `=' equal sign.
- underruns: set to trap on underruns instead of overruns.
- reuse: set to reuse freed memory in later allocations.
- churn: set to return a different pointer on every realloc.
- restart:
- set to `r' to retry after setting page as read-only.
- set to `w' to retry after setting page as read/write.
- available on systems providing the faulting data
- address to the signal hander.
- backtrace:
- set to provide a backtrace in the logfile
- available on glibc systems.
- level:
- set to `e' to only log "errors".
- set to `w' to also log "warnings".
- set to `i' to also log "informational".
- large: set to `n' to log allocations larger than `n' bytes.
- limit: set to `n' to limit total memory usage to `n' bytes.
`k', `K', `m', `M', and `g', `G' may be used as multipliers.
- Supported platforms:
- alpha-unknown-freebsd5.3
- alpha-unknown-netbsd2.1.0
- alphaev56-dec-osf4.0g
- alphaev6-unknown-linux-gnu
- alphaev67-dec-osf5.1
- alphaev67-unknown-linux-gnu
- alphaev68-dec-osf5.1
- alphaev7-dec-osf5.1
- armv4l-unknown-linux-gnu
- hppa2.0w-hp-hpux11.11
- hppa2.0w-hp-hpux11.23
- hppa64-unknown-linux-gnu
- i386-pc-sco3.2v5.0.4
- i386-unknown-freebsd5.3
- i386-unknown-netbsdelf2.0
- i386-unknown-openbsd3.2
- i686-pc-linux-gnu
- i686-redhat-linux-gnu
- ia64-hp-hpux11.23 (*)
- ia64-redhat-linux-gnu
- mips-sgi-irix65
- powerpc-apple-darwin6.6
- rs6000-ibm-aix3.2.5
- s390-ibm-linux-gnu
- sparc-sun-solaris2.5
- sparc-sun-solaris2.8
- sparc-unknown-netbsdelf1.5
- sparc64-unknown-linux-gnu (*)
- x86_64-redhat-linux-gnu
- (*) Faulting data address not provided to the signal handler.
restart won't work, and the address isn't logged.
- (**) libtool has some kind of incompatibility with hpux.
It can't seem to build shared libraries with either gcc or cc.