If all of the allocated memory is filled with zeros, the behavior of the program is much more reproducible (so the behavior will most likely be the same if you re-run your program). This is why I do not use malloc uninitialized zones.
(for the same reasons, when debugging a program in C or C ++ on Linux, I usually do echo 0 > /proc/sys/kernel/randomize_va_space , so the behavior of mmap more reproducible).
And if your program does not allocate huge blocks (i.e. tens of megabytes), the time spent inside malloc is much longer than the time to zero.
source share