Reason for doing malloc / bzero over calloc (performance)?

Garrett Cooper youshi10 at u.washington.edu
Wed Jun 13 07:38:39 UTC 2007


Garrett Cooper wrote:
>    Title says it all -- is there a particular reason why malloc/bzero 
> should be used instead of calloc?
> -Garrett
As someone just brought to my attention, I should do some Googling.

Initial results brought up this: 
<http://boredzo.org/blog/archives/2006-11-26/calloc-vs-malloc>. I would 
like to provide results for CURRENT, but I don't know offhand what C 
interface right supports nanoseconds or microseconds precision timing in 
FreeBSD (apart from just doing nanosleeps, which isn't such a great idea 
and can drift I would think due to clock skew). The original author's 
solution is for Mac OSX only :(..

I think it's decided though -- calloc for now wins over malloc / bzero, 
so I'm going to change that alloc/bzero to reflect the change.

-Garrett


More information about the freebsd-hackers mailing list