mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-24 17:06:25 -05: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
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