From owner-freebsd-questions@FreeBSD.ORG Mon Dec 1 22:57:29 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB41E1065670 for ; Mon, 1 Dec 2008 22:57:29 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell.rawbw.com (shell.rawbw.com [198.144.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 93D288FC13 for ; Mon, 1 Dec 2008 22:57:29 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from eagle.syrec.org (c-67-188-126-36.hsd1.ca.comcast.net [67.188.126.36]) (authenticated bits=0) by shell.rawbw.com (8.13.6/8.13.6) with ESMTP id mB1MvPhQ042985; Mon, 1 Dec 2008 14:57:25 -0800 (PST) Message-ID: <49346BD3.5080506@rawbw.com> Date: Mon, 01 Dec 2008 14:57:23 -0800 From: Yuri User-Agent: Thunderbird 2.0.0.18 (X11/20081127) MIME-Version: 1.0 To: Giorgos Keramidas References: <49345710.9070403@rawbw.com> <874p1njz3l.fsf@kobe.laptop> In-Reply-To: <874p1njz3l.fsf@kobe.laptop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Why process memory starts so high up in virtual space with FreeBSD malloc? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: yuri@rawbw.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 22:57:29 -0000 Giorgos Keramidas wrote: > The FreeBSD malloc(3) implementation can use either mmap() or sbrk() to > obtain memory from the system. It does not 'waste a high percentage of > memory' but it simply maps only high addresses (with an unmapped 'hole' > in lower addresses). > But the hole it leaves with MALLOC_OPTIONS='dM' is way larger than the one left by 'Dm' option. Usually malloc will keep allocating addresses higher than this initial value and will never come back and fill some parts of this gap. Therefore "wasting" this space. Yuri