Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Dec 2008 13:42:20 +0200
From:      Giorgos Keramidas <keramida@freebsd.org>
To:        yuri@rawbw.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Why process memory starts so high up in virtual space with FreeBSD malloc?
Message-ID:  <87ljuy2483.fsf@kobe.laptop>
In-Reply-To: <49346BD3.5080506@rawbw.com> (yuri@rawbw.com's message of "Mon, 01 Dec 2008 14:57:23 -0800")
References:  <49345710.9070403@rawbw.com> <874p1njz3l.fsf@kobe.laptop> <49346BD3.5080506@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 01 Dec 2008 14:57:23 -0800, Yuri <yuri@rawbw.com> wrote:
> 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.

The 'D' and 'M' options set what malloc() will _prefer_, they do not
force malloc() to use _only_ the particular type of memory space.  As
Dan explained in another post, both memory types will be used if there
is need for more address space.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87ljuy2483.fsf>