3 ms·
Is the confusion coming from when you malloc() memory in C you aren't getting zereoed memory?
by bluedino 4y ago
Is the confusion coming from when you malloc() memory in C you aren't getting zereoed memory?
- dale_glass 4y agoI tried on Linux, and got all zeroes. Of course that's for a trivial program. If you freed something, that probably wasn't returned to the OS, and the next malloc might just recycle it.
- bluedino 4y agoMalloc a bunch of memory, dirty it, free it, then malloc some more. And then check. Your first request in your program, you'll get clean memory from the OS.
- dale_glass 4y agoYeah, that's what I'm saying.