From owner-freebsd-current@FreeBSD.ORG Fri Feb 17 16:28:53 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C30E416A420; Fri, 17 Feb 2006 16:28:53 +0000 (GMT) (envelope-from jasone@FreeBSD.org) Received: from lh.synack.net (lh.synack.net [204.152.188.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id C4AD943D70; Fri, 17 Feb 2006 16:28:49 +0000 (GMT) (envelope-from jasone@FreeBSD.org) Received: by lh.synack.net (Postfix, from userid 100) id 9DF375E48F6; Fri, 17 Feb 2006 08:28:49 -0800 (PST) Received: from [192.168.168.201] (moscow-cuda-gen2-68-64-60-20.losaca.adelphia.net [68.64.60.20]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lh.synack.net (Postfix) with ESMTP id 082D15E48E5; Fri, 17 Feb 2006 08:28:47 -0800 (PST) Message-ID: <43F5F9BB.6000607@FreeBSD.org> Date: Fri, 17 Feb 2006 08:28:43 -0800 From: Jason Evans User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dmitry Pryanishnikov References: <20060215024339.N22450@atlantis.atlantis.dp.ua> <43F29BF5.4060300@freebsd.org> <20060216140725.T23429@atlantis.atlantis.dp.ua> <20060217013427.GB31540@xor.obsecurity.org> <20060217093631.J79078@atlantis.atlantis.dp.ua> In-Reply-To: <20060217093631.J79078@atlantis.atlantis.dp.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on lh.synack.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: Alan Cox , freebsd-current@freebsd.org, Peter Wemm , Kris Kennaway Subject: Re: Virtual memory consumption (both user and kernel) in modern CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2006 16:28:53 -0000 Dmitry Pryanishnikov wrote: > My main question is: can we avoid allocating 50Mb for "Hello, world!"-type > program? If it's just plain bug in new malloc, it should be corrected. If > this huge allocation is absolutely necessary, one should at least have a > choice (maybe, link-time option) which memory allocator to use, and > don't link > plain /bin/sh against virtual memory hungry allocator. Yes, it is possible to avoid using large amounts of virtual memory. See the malloc(3) man page for info on all of the ways that the allocator can be tuned. In this case, you are looking for the 'k' option. For instance, if you set /etc/malloc.conf to 'kkkkkk', the allocator will use a chunk size of 256kB rather than 16MB. I would like to change the default chunk size to something in the 256kB-1MB range, but Peter Wemm has some concerns about how that will interact with the VM subsystem. The basic problem is that the kernel is particularly naive about how it coalesces adjacent mappings, so it's possible to end up with a horribly fragmented virtual memory map. I don't have the time to fix this problem right now, and I'm not going to change the default chunk size unless Peter Wemm and/or Alan Cox say it's okay to do so. Jason