Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2002 14:46:12 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Danny Braniss <danny@cs.huji.ac.il>, Poul-Henning Kamp <phk@critter.freebsd.dk>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: malloc
Message-ID:  <20021022194612.GA7165@dan.emsphone.com>
In-Reply-To: <3DB5A73C.20513D50@mindspring.com>
References:  <E183u5Y-0003Yc-00@cse.cs.huji.ac.il> <3DB50A5A.F87EDA78@mindspring.com> <20021022153347.GA92973@dan.emsphone.com> <3DB5A73C.20513D50@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 22), Terry Lambert said:
> Dan Nelson wrote:
> > > The FreeBSD malloc uses anonymous pages mmap'ed off of /dev/zero.
> > >
> > > The Linux malloc uses pages added to the process address space via a
> > > call to sbrk.
> > 
> > Actually, on FreeBSD only the page directory is mmap'ed.  Data
> > returned to the user is allocated via sbrk.
> 
> Please see:
> 
> 	/usr/src/lib/libc/stdlib/malloc.c
> 
> The only calls to sbrk have a 0 argument.  This is only used to find
> the segment end, so that the mmap's do not occur over top of anything
> important.

Ah, but take a look at the calls to brk, especially in map_pages() and
free_pages().

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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