duma_2_5_15/ 0000755 0001750 0001750 00000000000 11164267736 012335 5 ustar ayguen ayguen duma_2_5_15/CVS/ 0000755 0001750 0001750 00000000000 11164267735 012767 5 ustar ayguen ayguen duma_2_5_15/CVS/Root 0000644 0001750 0001750 00000000072 11164267727 013635 0 ustar ayguen ayguen :pserver:anonymous@duma.cvs.sourceforge.net:/cvsroot/duma
duma_2_5_15/CVS/Repository 0000644 0001750 0001750 00000000005 11164267727 015065 0 ustar ayguen ayguen duma
duma_2_5_15/CVS/Entries 0000644 0001750 0001750 00000005473 11164267735 014334 0 ustar ayguen ayguen /.cvsignore/1.2/Sun Sep 5 23:24:48 2004//TVERSION_2_5_15
/CHANGELOG/1.77/Sat Apr 11 18:58:48 2009//TVERSION_2_5_15
/COPYING-GPL/1.1/Wed May 21 21:22:52 2003//TVERSION_2_5_15
/COPYING-LGPL/1.1/Wed May 21 21:22:52 2003//TVERSION_2_5_15
/GNUmakefile/1.3/Sun Aug 3 19:22:38 2008//TVERSION_2_5_15
/INSTALL/1.8/Tue Mar 17 23:04:43 2009//TVERSION_2_5_15
/README.txt/1.20/Mon Apr 6 22:26:47 2009//TVERSION_2_5_15
/TODO/1.18/Mon Apr 6 22:27:42 2009//TVERSION_2_5_15
/WIN32_DETOURS_HOWTO.txt/1.5/Sun Oct 22 23:16:43 2006//TVERSION_2_5_15
/builddocs.bat/1.3/Sun Oct 22 23:16:48 2006//TVERSION_2_5_15
/createconf.c/1.24/Sat Apr 11 12:40:31 2009//TVERSION_2_5_15
/createconf_new.cpp/1.2/Sun Aug 3 20:44:17 2008//TVERSION_2_5_15
/duma.3/1.2/Sun Sep 4 00:32:17 2005//TVERSION_2_5_15
/duma.c/1.68/Sat Apr 11 18:58:23 2009//TVERSION_2_5_15
/duma.h/1.20/Sat Apr 11 12:32:05 2009//TVERSION_2_5_15
/duma.sh/1.7/Sun Jul 20 22:59:32 2008//TVERSION_2_5_15
/duma_hlp.h/1.13/Tue Apr 22 23:19:39 2008//TVERSION_2_5_15
/duma_sem.h/1.3/Sat Apr 11 12:34:23 2009//TVERSION_2_5_15
/dumapp.cpp/1.18/Sun Aug 3 20:46:06 2008//TVERSION_2_5_15
/dumapp.h/1.16/Sat Apr 11 12:41:44 2009//TVERSION_2_5_15
/dumatest.c/1.15/Tue Mar 17 23:04:43 2009//TVERSION_2_5_15
/dumatestpp.cpp/1.5/Tue Mar 17 23:04:43 2009//TVERSION_2_5_15
/example1.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/example2.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/example3.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/example4.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/example5.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/example6.cpp/1.4/Sun Jul 15 02:20:14 2007//TVERSION_2_5_15
/gdbinit.rc/1.1/Wed Mar 12 22:16:18 2008//TVERSION_2_5_15
/mkclean.bat/1.2/Mon Jan 3 23:15:16 2005//TVERSION_2_5_15
/noduma.h/1.12/Sun Aug 3 20:46:16 2008//TVERSION_2_5_15
/package.sh/1.5/Sun Aug 3 20:51:44 2008//TVERSION_2_5_15
/paging.h/1.19/Sun Aug 3 20:47:48 2008//TVERSION_2_5_15
/print.c/1.27/Sat Apr 11 12:33:47 2009//TVERSION_2_5_15
/print.h/1.11/Sat Apr 11 12:32:46 2009//TVERSION_2_5_15
/sem_inc.c/1.25/Mon Apr 6 22:32:37 2009//TVERSION_2_5_15
/testalloc0.cpp/1.2/Sun Apr 27 21:25:03 2008//TVERSION_2_5_15
/testalloc0.sh/1.1/Wed Apr 23 00:31:48 2008//TVERSION_2_5_15
/testenv.c/1.1/Thu Aug 16 00:31:20 2007//TVERSION_2_5_15
/testmt.c/1.13/Sun Aug 3 22:47:58 2008//TVERSION_2_5_15
/testoperators.cpp/1.11/Tue Mar 17 23:04:43 2009//TVERSION_2_5_15
/testsems.cpp/1.1/Mon Apr 6 22:16:11 2009//TVERSION_2_5_15
/thread-test.c/1.6/Tue Mar 17 23:04:43 2009//TVERSION_2_5_15
/tstheap.c/1.11/Tue Sep 27 23:04:48 2005//TVERSION_2_5_15
D/comparisons////
D/debian////
D/detours////
D/detoursexample1////
D/docs-data////
D/dumadetours////
D/dumadetoursdll////
D/dumadll////
D/example_makes////
D/kduma////
D/stacktrace////
D/win32-devcpp////
D/win32-msvc////
D/win32-msvc.2005////
D/win32-msvc.net////
D/win32-vide////
duma_2_5_15/CVS/Tag 0000644 0001750 0001750 00000000020 11164267731 013411 0 ustar ayguen ayguen NVERSION_2_5_15
duma_2_5_15/comparisons/ 0000755 0001750 0001750 00000000000 11164267731 014665 5 ustar ayguen ayguen duma_2_5_15/comparisons/CVS/ 0000755 0001750 0001750 00000000000 11164267735 015324 5 ustar ayguen ayguen duma_2_5_15/comparisons/CVS/Root 0000644 0001750 0001750 00000000072 11164267731 016165 0 ustar ayguen ayguen :pserver:anonymous@duma.cvs.sourceforge.net:/cvsroot/duma
duma_2_5_15/comparisons/CVS/Repository 0000644 0001750 0001750 00000000021 11164267731 017413 0 ustar ayguen ayguen duma/comparisons
duma_2_5_15/comparisons/CVS/Entries 0000644 0001750 0001750 00000000504 11164267735 016657 0 ustar ayguen ayguen /README.txt/1.2/Mon Jan 14 23:12:01 2008//TVERSION_2_5_15
/memCheckers.html/1.1/Mon Jan 14 23:03:23 2008//TVERSION_2_5_15
D/ex11////
D/ex12////
D/ex13////
D/ex14////
D/ex15////
D/ex16////
D/ex17////
D/ex21////
D/ex22////
D/ex23////
D/ex24////
D/ex25////
D/ex26////
D/ex27////
D/ex28////
D/ex29////
D/memCheckers-Dateien////
duma_2_5_15/comparisons/CVS/Tag 0000644 0001750 0001750 00000000020 11164267731 015746 0 ustar ayguen ayguen NVERSION_2_5_15
duma_2_5_15/comparisons/ex11/ 0000755 0001750 0001750 00000000000 11164267731 015443 5 ustar ayguen ayguen duma_2_5_15/comparisons/ex11/CVS/ 0000755 0001750 0001750 00000000000 11164267731 016076 5 ustar ayguen ayguen duma_2_5_15/comparisons/ex11/CVS/Root 0000644 0001750 0001750 00000000072 11164267731 016743 0 ustar ayguen ayguen :pserver:anonymous@duma.cvs.sourceforge.net:/cvsroot/duma
duma_2_5_15/comparisons/ex11/CVS/Repository 0000644 0001750 0001750 00000000026 11164267731 020176 0 ustar ayguen ayguen duma/comparisons/ex11
duma_2_5_15/comparisons/ex11/CVS/Entries 0000644 0001750 0001750 00000000162 11164267731 017431 0 ustar ayguen ayguen /Makefile/1.1/Mon Jan 14 22:49:07 2008//TVERSION_2_5_15
/wrong1.c/1.1/Mon Jan 14 22:49:07 2008//TVERSION_2_5_15
D
duma_2_5_15/comparisons/ex11/CVS/Tag 0000644 0001750 0001750 00000000020 11164267731 016524 0 ustar ayguen ayguen NVERSION_2_5_15
duma_2_5_15/comparisons/ex11/Makefile 0000644 0001750 0001750 00000000543 10742763343 017106 0 ustar ayguen ayguen
DUMADIR=../..
CFLAGS=-g -O0 -I$(DUMADIR) -include stdlib.h -include duma.h
LFLAGS=$(DUMADIR)/libduma.a
ifeq ($(OS), Windows_NT)
LIBS=
else
LIBS=-lpthread
endif
CC=gcc
CXX=g++
BIN=wrong1
OBJ=$(BIN).o
all: $(BIN)
./$(BIN)
clean:
- rm -f $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(OBJ) $(LFLAGS) $(LIBS) -o $(BIN)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
duma_2_5_15/comparisons/ex11/wrong1.c 0000644 0001750 0001750 00000000341 10742763343 017023 0 ustar ayguen ayguen #include
There are some freely available memory checkers. I ran a series of
very simple tests to determine what they can do. The wrong
series of tests contains code that makes pointer mistakes that are not
memory leaks, for example freeing a pointer twice, writing to
uninitialized memory or using delete instead of delete []. The
leak series of tests contains simple memory leaks,
i.e. pointers that are allocated but not released. The ok
series of tests contains programs that are correct and thus should not
cause the memory checker to output any alarm message.
Jean-Philippe Martin |
Resources | Memory Checkers Comparison
Memory Checkers
Memory checkers are debugging tools that help programmers find
improper use of pointers, typically memory leaks.
C tests
(updated 3/10/2006)
Checker
wrong1.c
wrong3.c
wrong6.c
wrong7.c
leak1.c
leak2.c
ok5.c
MALLOC_CHECK_
OK
missed
missed
OK*
missed
missed
OK
dmalloc
OK
missed
missed
OK
OK
OK
OK
memCheckDeluxe
missed
missed
missed
missed
OK
OK
OK
memwatch
OK
missed
missed*
OK
OK
OK
OK
DUMA
OK
missed
missed
OK
OK
OK*
OK
valgrind
OK
OK
missed
OK
OK
OK
OK
Checker | wrong1.cc | wrong2.cc | wrong3.cc | wrong4.cc | wrong5.cc | wrong6.cc | leak1.cc | leak2.cc | ok5.cc |
---|---|---|---|---|---|---|---|---|---|
MALLOC_CHECK_ | OK | OK | missed | missed | OK | missed | missed | missed | OK |
dmalloc | OK | OK* | missed* | missed | OK | missed | OK | OK | missed* |
DUMA | OK | OK | missed | OK | OK | missed | OK | OK | missed |
valgrind | OK | OK | OK* | OK | OK | missed | OK | OK | OK |
memWatch and memCheckDeluxe are both memory leak detectors, and they passed all the memory leak tests. Memwatch wins this round because it was able to detect the double-free in wrong1.c and the out-of-bounds accesses in the dynamically allocated array of wrong7.c (not the static array of wrong6 - but no one else did, either). Both programs are designed to work with C and require a recompilation.
MALLOC_CHECK_ is an interesting test: it is triggered simply by setting the environment variable MALLOC_CHECK_ to 1, and the rest of the magic is done by glibc (see the link in references, below). This is the easiest check to set up and it requires no recompilation. It detected the double free in wrong1 and the mismatched malloc/delete or new/free pairs in wrong2.cc and wrong5.cc. It was able to see that something was fishy in wrong7.c, but it reports a single error at the "free" instead of when we are accessing the memory instead of two errors, for each out-of-bounds access. MALLOC_CHECK_ cannot detect memory leaks and did not detect the use of uninitialized memory in wrong3.
dmalloc is more than a leak detector, but it didn't detect as many bad cases as valgrind and requires a recompile. Also, its C++ support is (in the author's words) minimal. In particular, I have not been able to get dmalloc to report line numbers with C++ (log), although that feature mostly works with C code - in both leak1.c and leak2.c it pointed to the return() instead of the line that allocated the unfreed memory. Dmalloc also often reports unfreed memory, even for programs that are correct. This may be because of errors in the c++ library, but it makes the reports harder to read. In contrast, valgrind has a way to hide leaks that it knows about so its reports are more clear. See also the author's comments.
valgrind is clearly the winner of this little contest. valgrind requires no recompilation of the program, so it's very easy to set up. It identified almost all of the incorrect pointer uses and memory leaks. The only test that it missed is wrong6, in which we break the bounds of an array. No other checker spotted that one, though. Also, valgrind has been improved since we ran this test, so it may perform even better than what we show here.
DUMA is a very close second. The results I am posting here come from Koneru Srikanth (kpsrikanth at gmail dot com) who generously sent them to me. DUMA seems not to require a recompile, but the tests were run on recompiled code. DUMA performs really well. It was also able to detect out-of-bounds writes (it is reported as failing wrong3.cc because it missed the out-of-bounds read). If for some reason valgrind does not work for you, then I recommend that you give DUMA a spin.
Please contact me if you have feedback or would like to suggest another tool for the test.