niedziela, 22 maja 2011

Memory allocation checking

Here is list how to check for memory allocation problems (leaks, writing past buffer, etc.)

glibc based:
- mcheck(), mprobe() functions and MALLOC_CHECK_ env. variable (see 'man malloc' and

- mtrace() function and 'mtrace' command

- glibc-utils (mtrace, xtrace, memusage, ...)

gcc based:
- Mudflap Pointer Debugging

- GCC extensions: Bounds checking patches, ProPolice Stack-Smashing Protector
One thing is not clear here - there is option -fbounds-check which seems to compile in gcc (does it work?) and 'bounds checking patches' which gives -fbounds-checking option.

One and only:
- valgrind

Other free solutions:
- Electric fence

- DUMA library

- Memwatch

- halloc - not really a checker but useful

- Insure++

- Purify (IBM-Rational)

There is basic question - maybe design approach should be different e.g.:
- allocate memory on startup (pool)
- use sentry to check if tasks release objects allocated on pool

Brak komentarzy:

Prześlij komentarz