logoalt Hacker News

petesergeanttoday at 3:05 AM2 repliesview on HN

> In C/C++, this doesn’t happen. When you allocate memory via `malloc()`, you get whatever was previously there.

What would break if the compiler zero'd it first? Do programs rely on malloc() giving them the data that was there before?


Replies

pelorattoday at 10:26 AM

That's what calloc() is for

mdavid626today at 7:45 AM

It takes time to zero out memory.