From owner-freebsd-hackers Tue Oct 22 4:50:33 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 2059237B401 for ; Tue, 22 Oct 2002 04:50:32 -0700 (PDT) Received: from chiark.greenend.org.uk (chiark.greenend.org.uk [212.135.138.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 198D143E6A for ; Tue, 22 Oct 2002 04:50:31 -0700 (PDT) (envelope-from fanf@chiark.greenend.org.uk) Received: from fanf by chiark.greenend.org.uk with local (Exim 3.12 #1) id 183xYK-0003aB-00 (Debian); Tue, 22 Oct 2002 12:50:28 +0100 To: tlambert2@mindspring.com From: Tony Finch Cc: hackers@freebsd.org Subject: Re: malloc In-Reply-To: <3DB50A5A.F87EDA78@mindspring.com> References: Message-Id: Date: Tue, 22 Oct 2002 12:50:28 +0100 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 Terry Lambert 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. Utter bollocks. FreeBSD malloc can be configured to re-initialize memory on every allocation, but this is designed to assist with buggy programs, it is *not* a security measure. Memory obtained from the kernel on *all* unices (including Linux) is zeroed; that is when security matters, not in malloc. This will not affect the relative performance of phk and gnu malloc. >The FreeBSD malloc references an environment variable and a readlink() >of a potentially non-existant symbolic link containing configuration >data for the malloc. Once at program startup. This is not a significant cost. >The FreeBSD allocation is an overcommit allocation True for Linux too, by default. Tony. -- f.a.n.finch http://dotat.at/ NORTH UTSIRE: EAST 4 OR 5 INCREASING 6 TO GALE 8. RAIN. MODERATE. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message