It’s been a while since my last post. Let’s restart with something light.
To know the answer, you can read the manual:
malloc is NOT backed by real memory allocation in OSes (like Linux) with optimistic memory allocation strategy
until the program actually touches that part of memory. That also means the memory chunk ‘allocated’ is not initialized.
calloc on the other hand touches the memory by writing zeros (initializing) to it and therefore is backed by real memory on RAM.
calloc does more real work than
malloc, including actually finding an available memory block and initializing it,
is also slower.