Why doesn't free() zero out the memory prior to releasing it?
问题 When we free() memory in C, why is that memory not filled with zero? Is there a good way to ensure this happens as a matter of course when calling free() ? I'd rather not risk leaving sensitive data in memory released back to the operating system... 回答1: Zeroing out the memory block when freeing it will require extra time. Since most of time there's actually no need in it it is not done by default. If you really need (say you used memory for storing a password or a cryptographic key) - call