From owner-cvs-src@FreeBSD.ORG Sat Mar 25 09:41:38 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07A9E16A422; Sat, 25 Mar 2006 09:41:38 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77E2943D46; Sat, 25 Mar 2006 09:41:37 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id C57C82082; Sat, 25 Mar 2006 10:41:31 +0100 (CET) X-Spam-Tests: AWL,BAYES_00,FORGED_RCVD_HELO X-Spam-Learn: ham X-Spam-Score: -2.4/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on tim.des.no Received: from xps.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id B3C562081; Sat, 25 Mar 2006 10:41:31 +0100 (CET) Received: by xps.des.no (Postfix, from userid 1001) id 5A8DF33C8D; Sat, 25 Mar 2006 10:41:31 +0100 (CET) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Jason Evans References: <200603232337.k2NNb6tH020675@repoman.freebsd.org> <86irq45etp.fsf@xps.des.no> <442444C4.8020404@elischer.org> <86k6ajpmvb.fsf@xps.des.no> <442475D1.5010903@FreeBSD.org> Date: Sat, 25 Mar 2006 10:41:30 +0100 In-Reply-To: <442475D1.5010903@FreeBSD.org> (Jason Evans's message of "Fri, 24 Mar 2006 14:42:25 -0800") Message-ID: <863bh6q2t1.fsf@xps.des.no> User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Julian Elischer , Peter Wemm Subject: Re: cvs commit: src/lib/libc/sys mmap.2 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Mar 2006 09:41:38 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Jason Evans writes: > By choosing a malloc size of 1MB in your test program, you just > happened to pick the worst possible case for malloc chunk > fragmentation (50% utilization). In reality, the reason that you > hit a limit of 697 on i386 is that you used pretty much the entire > mmap()able address space (2*697MB =3D=3D 1394MB). On i386, jemalloc > switches from sbrk() to mmap() when heap space runs out. How about this, then, with malloc(1024): % ulimit -d 2097152 % ./allocate 2861145 kB % ulimit -d $((1024*1024)) % ./allocate 1861209 kB % ulimit -d $((512*1024)) % ./allocate 1361241 kB In all cases, it should stop when it reaches dsiz. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Disposition: attachment; filename=allocate.c /* * cc -Wall -pedantic -std=c99 -O2 -pipe -o allocate allocate.c */ #include #include #include static volatile sig_atomic_t sig_caught; static void sig_handler(int sig) { sig_caught = sig; } int main(void) { int i = 0; signal(SIGINT, sig_handler); while (!sig_caught && malloc(1024) != NULL) { if (++i % 128 == 0) printf("\r%d MB", i / 1024); fflush(stdout); } printf("\r%d kB\n", i); if (sig_caught) printf("interrupted\n"); exit(0); } --=-=-=--