From owner-freebsd-current Wed Mar 13 22:25:49 2002 Delivered-To: freebsd-current@freebsd.org Received: from root.com (unknown [209.102.106.178]) by hub.freebsd.org (Postfix) with ESMTP id 76AEC37B402 for ; Wed, 13 Mar 2002 22:25:47 -0800 (PST) Received: (from dg@localhost) by root.com (8.11.2/8.11.2) id g2E6PIl34855; Wed, 13 Mar 2002 22:25:18 -0800 (PST) (envelope-from dg) Date: Wed, 13 Mar 2002 22:25:18 -0800 From: David Greenman To: Poul-Henning Kamp Cc: John Indra , freebsd-current@FreeBSD.ORG Subject: Re: malloc() and the stock Perl in -CURRENT (and -STABLE) Message-ID: <20020313222518.J27616@nexus.root.com> References: <20020314104525.B8244@office.naver.co.id> <40628.1016085846@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40628.1016085846@critter.freebsd.dk>; from phk@critter.freebsd.dk on Thu, Mar 14, 2002 at 07:04:06AM +0100 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: > > n = 2 > for (i = 0; i < 1000000; i++) > realloc(n++); > >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 President, TeraSolutions, Inc. - http://www.terasolutions.com President, Download Technologies, Inc. - http://www.downloadtech.com Pave the road of life with opportunities. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message