From owner-freebsd-current Wed Mar 13 22:38:13 2002 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 87DCD37B417 for ; Wed, 13 Mar 2002 22:38:09 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g2E6bw438311; Wed, 13 Mar 2002 22:37:58 -0800 (PST) (envelope-from dillon) Date: Wed, 13 Mar 2002 22:37:58 -0800 (PST) From: Matthew Dillon Message-Id: <200203140637.g2E6bw438311@apollo.backplane.com> To: David Greenman Cc: Poul-Henning Kamp , John Indra , freebsd-current@FreeBSD.ORG Subject: Re: malloc() and the stock Perl in -CURRENT (and -STABLE) References: <20020314104525.B8244@office.naver.co.id> <40628.1016085846@critter.freebsd.dk> <20020313222518.J27616@nexus.root.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :>The above perl program results in a loop more or less like: :... :> :>Now, if you read _any_ malloc(3) man page, they will tell you that there :>is no way it can be guaranteed that this does not result in a lot of :>copying. : : Um, except that copying isn't what is causing the problem. The performance :problem is apparantly caused by tens of thousands of page faults per second as :the memory is freed and immediately reallocated again from the kernel. Doesn't :phkmalloc keep a small pool of allocations around to avoid problems like :this? : :-DG : :David Greenman :Co-founder, The FreeBSD Project - http://www.freebsd.org I can significantly reduce page faulting for the above test (rewritten in C below) with the following: rm /etc/malloc.conf ln -s ">>>>>>>>>>>>" /etc/malloc.conf That cuts it down by a factor of 15 to 25. -Matt Matthew Dillon #include #include #include int main(int ac, char **av) { char *ptr = NULL; int i; for (i = 2; i < 1000000; ++i) ptr = realloc(ptr, i); return(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message