From owner-freebsd-questions@FreeBSD.ORG Tue Aug 5 07:03:54 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 613DE1065673 for ; Tue, 5 Aug 2008 07:03:54 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id CFFC78FC1E for ; Tue, 5 Aug 2008 07:03:53 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl19-159.kln.forthnet.gr [77.49.146.159]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m7573hgv007560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 5 Aug 2008 10:03:50 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m7573hNk039090; Tue, 5 Aug 2008 10:03:43 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m7573hHh039089; Tue, 5 Aug 2008 10:03:43 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: "Shyamal Shukla" References: <87ej54hrrz.fsf@kobe.laptop> Date: Tue, 05 Aug 2008 10:03:42 +0300 In-Reply-To: <87ej54hrrz.fsf@kobe.laptop> (Giorgos Keramidas's message of "Tue, 05 Aug 2008 09:58:40 +0300") Message-ID: <87abfshrjl.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: m7573hgv007560 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.815, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.58, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: memory allocation with malloc X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2008 07:03:54 -0000 On Tue, 05 Aug 2008 09:58:40 +0300, Giorgos Keramidas wrote: > On Tue, 5 Aug 2008 11:46:06 +0530, "Shyamal Shukla" wrote: >> However, this does not happen. Can someone please correct my >> understanding and provide me with a reference to the working of >> malloc() and free()? > > That's because the original assumption is false. [...] I forgot to attach the link to the jemalloc paper, apologies. Here it is: http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf This describes how jemalloc works. This isn't a detailed line by line walk-through of the source, but it should provide a good starting point. Then you can always read the source of BSD malloc() at: http://svn.freebsd.org/viewvc/base/head/lib/libc/stdlib/malloc.c?view=log HTH, Giorgos