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 http://www.gnu.org/s/libc/manual/html_node/Heap-Consistency-Checking.html)
- mtrace() function and 'mtrace' command http://www.gnu.org/s/libc/manual/html_node/Allocation-Debugging.html
- glibc-utils (mtrace, xtrace, memusage, ...)
gcc based:
- Mudflap Pointer Debugging http://gcc.gnu.org/wiki/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 http://directory.fsf.org/project/ElectricFence/
- DUMA library http://sourceforge.net/projects/duma/
- Memwatch http://www.linkdata.se/sourcecode/memwatch/
- halloc - not really a checker but useful http://directory.fsf.org/project/halloc/
Proprietary:
- 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
niedziela, 22 maja 2011
niedziela, 15 maja 2011
Here are potentially useful libraries used in Samba project.
TDB (Trivial DataBase)
"In concept, it is very much like GDBM, and BSD's DB except that it allows multiple simultaneous writers and uses locking internally to keep writers from trampling on each other. tdb is also extremely small."
It has added transactions support.
http://tdb.samba.org/index.html
TAlloc
"Hierarchical, reference counted memory pool system with destructors. It is the core memory allocator used in Samba (LGPL)."
http://talloc.samba.org/talloc/doc/html/index.html
man 3 talloc
TEvent
"Tevent is an event system based on the talloc memory management library."
http://tevent.samba.org/index.html
All Samba related sub-projects one can find at http://samba.com under "Related Sites".
Additionally here is page with junk code form Samba author:
http://www.samba.org/junkcode/
More description of junk code in conference materials.
Especially worth mentioning is 'segv_handler'.
TDB (Trivial DataBase)
"In concept, it is very much like GDBM, and BSD's DB except that it allows multiple simultaneous writers and uses locking internally to keep writers from trampling on each other. tdb is also extremely small."
It has added transactions support.
http://tdb.samba.org/index.html
TAlloc
"Hierarchical, reference counted memory pool system with destructors. It is the core memory allocator used in Samba (LGPL)."
http://talloc.samba.org/talloc/doc/html/index.html
man 3 talloc
TEvent
"Tevent is an event system based on the talloc memory management library."
http://tevent.samba.org/index.html
All Samba related sub-projects one can find at http://samba.com under "Related Sites".
Additionally here is page with junk code form Samba author:
http://www.samba.org/junkcode/
More description of junk code in conference materials.
Especially worth mentioning is 'segv_handler'.
Parallel mode extensions in gcc standard c++ library
Approach based on OpenMP. Here is info regarding the extension:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html
http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html
Subskrybuj:
Posty (Atom)