4 ms·
Actually, this (to me) looks like a good change. I assume many people's code is having problem with uninitialised memory. If your code worked before, it will s
by CJefferson 11y ago
Actually, this (to me) looks like a good change. I assume many people's code is having problem with uninitialised memory.
If your code worked before, it will still work now with no changes, and in practice I've rarely noticed zeroing a buffer causing any measurable overhead (zeroing is so cheap compared to the cost of then filling the buffer anyway. In fact, it can be cheaper to zero, because there is no need to read the old stale values from memory into cache).
There is also a new better designed interface, but the old one still works fine. I can't really imagine a better change.
- PeCaN 11y agoActually, there's often no cost at all to allocating a zeroed buffer. FreeBSD zeroes out free memory in its idle time and uses that for calloc(). Linux hands out a pointer to a shared read-only page of zero memory and then gives you "real" memory when you write to it. I suspect NT does something like Linux, but I don't think its precise [mc]alloc() implementation is documented.