From owner-freebsd-hackers Tue Oct 22 12:49:19 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DAD937B401 for ; Tue, 22 Oct 2002 12:49:18 -0700 (PDT) Received: from avocet.mail.pas.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id B920143E6A for ; Tue, 22 Oct 2002 12:49:17 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0482.cvx21-bradley.dialup.earthlink.net ([209.179.193.227] helo=mindspring.com) by avocet.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 18451e-0000LV-00; Tue, 22 Oct 2002 12:49:14 -0700 Message-ID: <3DB5AB73.E334629@mindspring.com> Date: Tue, 22 Oct 2002 12:48:03 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Tony Finch Cc: hackers@freebsd.org Subject: Re: malloc References: <3DB5A07F.AA118FA6@mindspring.com> <20021022202533.A29425@chiark.greenend.org.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Tony Finch wrote: > > > >The FreeBSD malloc guarantees that the pages are zeroed before being > > > >obtained from the system; this is probably the majority of the cost. > > > >It is a security measure, so that you do not leak data from one process > > > >to another through anonymous pages. > > > > > > > >The Linux malloc does not. [ ... ] > > > > *before being obtained from the system*. > > Linux does that too, and you appeared to be saying that it doesn't which > is clearly wrong for the security reasons that you stated. It therefore > won't affect the relative performance. Yes, it will. It has to do with the use of anonymous memory being different between the systems. You are arguing that there is nothing that can account for the performance difference, when in fact there is a measured performance difference. > > And I didn't say that. I only said that the pages were zeroed *before > > being obtained from the system*. This is what you would expect, with > > anonymous memory accessed off /dev/zero. > > PHK malloc uses MAP_ANON on FreeBSD, not /dev/zero -- it uses the > latter only if compiled for Solaris. And tell me, what does the Linux malloc use? -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message