Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2002 11:39:56 -0700 (PDT)
From:      Matthew Dillon <>
To:        Anders Nordby <anders@FreeBSD.ORG>
Cc:        Nuno Teixeira <>, Jens Rehsack <>, freebsd-stable@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Subject:   Re: squid and datasize kernel problems (was: openoffice stack and datasize kernel problems)
Message-ID:  <>
References:  <20020608153940.GA13033@gw.tex.bogus> <> <20020608161556.GC13033@gw.tex.bogus> <> <>

next in thread | previous in thread | raw e-mail | index | archive | help
:>     It should be noted that mmap() uses whatever VM space
:>     remains after MAXDSIZ and MAXSSIZ have been reserved, so
:>     increasing MAXDSIZ reduces the amount of VM available
:>     to mmap().  Still, a 1 GB MAXDSIZ should not result in
:>     system utilities / servers running out of mmap() space! 
:>     Userland has 3G of VM space to play with.
:I'm running into some similar issues when trying to make Squid eat as
:much as possible of the 4 GB memory I have installed in a Compaq
:ProLiant DL 380 G2. At first, Squid seems to die and restart when trying
:to allocate memory above 512 MB. By tuning MAXDSIZ, I have made it use
:up to around 2 GB. If I set MAXDSIZ (I now do it in loader.conf with
:kern.maxdsiz) above around 2950 MB, init starts failing upon boot:
:init in malloc(): error mmap(2) failed, check limits
:init in malloc(): warning: recursive call
:Does anyone have any clues on how to overcome this? I'll be trying out
:the the dlmalloc library that is distributed with Squid, but I suppose
:I do need a 4 GB maximum data size to be able to make Squid actually use
:4 GB. Is this possible, or am I being totally foolish?
:Any hint very appreciated. :-)

0xFFFFFFFF	+-----------------------+-----
		|			|
		|	KERNEL		| (1G)
		|			|
0xC0000000	+-----------------------+-----
		|			|
		|	    |		|
		|	    V		|
		|			|
		|			|
		|			|
		|			|  (stack, mmap, user data, program) = 3G
MAXDSIZ		+-----------------------+
		|			|
		|			|
		|			|
		|			|
0x00000000	+-----------------------+-----

    Any C program which uses shared libraries uses mmap().  Many library
    functions and libraries also use mmap(), including portions of our 
    malloc() implementation (though the main area used by mmap is the
    user data area).  If you increase MAXDSIZ to the point where there
    is not enough VM for the mmap()'s programs make then you will run
    into the problems you are having.

    I'm not sure why you are trying to have squid use all 4G of the
    machine directly in its user data area.  Squid caches a lot of
    things in memory, sure, but it also caches things in files and
    FreeBSD will use free physical memory to cache those files
    regardless of how you configure the machine.  So you should be
    getting good utilization of your 4G of memory even if Squid cannot
    use all 4G in its user data area directly.   Setting MAXDSIZ to
    2.9GB out of the 3G of user VM available puts a huge squeeze on
    how much the program can mmap() before it runs out of VM.

					Matthew Dillon 

To Unsubscribe: send mail to
with "unsubscribe freebsd-hackers" in the body of the message

Want to link to this message? Use this URL: <>