Re: Virtual memory consumption (both user and kernel) in modern CURRENT

From: Jason Evans <jasone_at_FreeBSD.org>
Date: Fri, 17 Feb 2006 08:28:43 -0800
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
Received on Fri Feb 17 2006 - 15:28:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC