mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Does'n preinitialize memory when running for valgrind.
This commit is contained in:
parent
f84ff1e74a
commit
027b6e3fcd
2 changed files with 10 additions and 0 deletions
|
|
@ -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])
|
||||
|
|
|
|||
2
util.c
2
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue