Date: Fri, 15 Jun 2007 17:47:03 +0200 From: Joerg Sonnenberger <joerg@britannica.bec.de> To: freebsd-hackers@freebsd.org Subject: Re: Reason for doing malloc / bzero over calloc (performance)? Message-ID: <20070615154703.GA2247@britannica.bec.de> In-Reply-To: <200706150104.l5F14RjG001010@apollo.backplane.com> References: <f4rpkm$2jh$1@sea.gmane.org> <Pine.LNX.4.43.0706141004260.10404@hymn01.u.washington.edu> <f4seg6$gmi$1@sea.gmane.org> <200706150104.l5F14RjG001010@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 14, 2007 at 06:04:27PM -0700, Matthew Dillon wrote: > From this point of view it is much, much better to bzero() memory that > is already mapped then it is to map/unmap new memory. For kernel land, you are right. For userland, there's one big down-side to always bzero/memset newly allocated memory: it touches the page and thereby can add a lot of back pressure on you are not having that much memory. This can be completely uncessary at that point and at least one application of using calloc with large parameter values is creation of a hash table. Forcing it to consume memory is not such a good idea. Joerg
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070615154703.GA2247>