3 ms·
Actually, 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 ou
by PeCaN 11y ago
Actually, 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.