diff --git a/configure.ac b/configure.ac index 135eec5d..1fb1e6a3 100644 --- a/configure.ac +++ b/configure.ac @@ -85,9 +85,17 @@ AC_ARG_ENABLE([valgrind], [AS_HELP_STRING([--enable-valgrind],[enable the use of valgrind in testing])], [ TESTENV="$VALGRIND" + CFLAGS="$CFLAGS -DCHECKER" ], []) +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug],[enable debugging])], + [ + TESTENV="" + CFLAGS="-O0 -g" + ], + []) AC_ARG_VAR([TESTENV], [Test environment]) AC_CONFIG_FILES([Makefile]) diff --git a/util.c b/util.c index db0b3f04..38a085cc 100644 --- a/util.c +++ b/util.c @@ -722,6 +722,7 @@ void* malloc_nofail(size_t size) exit(EXIT_FAILURE); } +#ifndef CHECKER /* Don't preinitialize when running for valgrind */ /* Here we preinitialize the memory to ensure that the OS is really allocating it */ /* and not only reserving the addressable space. */ /* Otherwise we are risking that the OOM (Out Of Memory) killer in Linux will kill the process. */ @@ -729,6 +730,7 @@ void* malloc_nofail(size_t size) /* get a real error from malloc() instead than a process killed. */ /* Note that calloc() doesn't have the same effect. */ memset(ptr, 0xA5, size); +#endif mcounter += size;