From owner-freebsd-current@FreeBSD.ORG Sat Nov 28 13:09:09 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3904D106566B; Sat, 28 Nov 2009 13:09:09 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay001.isp.belgacom.be (mailrelay001.isp.belgacom.be [195.238.6.51]) by mx1.freebsd.org (Postfix) with ESMTP id 803B78FC13; Sat, 28 Nov 2009 13:09:08 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArcEAGapEEtR8EdJ/2dsb2JhbACBTdB8hDEE Received: from 73.71-240-81.adsl-dyn.isp.belgacom.be (HELO kalimero.atlascopco.be) ([81.240.71.73]) by relay.skynet.be with ESMTP; 28 Nov 2009 13:39:39 +0100 Received: from kalimero.atlascopco.be (kalimero.atlascopco.be [127.0.0.1]) by kalimero.atlascopco.be (8.14.3/8.14.3) with ESMTP id nASCcruV002359; Sat, 28 Nov 2009 13:39:08 +0100 (CET) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: Maxim Sobolev Date: Sat, 28 Nov 2009 13:38:50 +0100 User-Agent: KMail/1.9.10 References: <4B1041EB.9020109@sippysoft.com> In-Reply-To: <4B1041EB.9020109@sippysoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-u" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200911281338.53430.tijl@coosemans.org> Cc: FreeBSD Hackers , stable@freebsd.org, freebsd-current@freebsd.org Subject: Re: heap limits: mmap(2) vs. break(2) on i386 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: Sat, 28 Nov 2009 13:09:09 -0000 On Friday 27 November 2009 22:17:31 Maxim Sobolev wrote: > I am trying to figure out why java fails to start with 1024MB of heap > on i386 with 4GB of RAM and 4GB of swap. Both MAXDSIZ and DFLDSIZ are > set to 2GB. Here is my limits: > > Resource limits (current): > cputime infinity secs > filesize infinity kB > datasize 2097152 kB > stacksize 65536 kB > coredumpsize infinity kB > memoryuse infinity kB > memorylocked infinity kB > maxprocesses 5547 > openfiles 20000 > sbsize infinity bytes > vmemoryuse infinity kB > > Running ktrace I see: > > 9154 java CALL mmap(0,0x44000000,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,0xffffffff,0,0) > 9154 java RET mmap -1 errno 12 Cannot allocate memory > 9154 java CALL write(0x1,0xbf9fe378,0x2b) > 9154 java GIO fd 1 wrote 43 bytes > "Error occurred during initialization of VM On i386 a process has only 3GiB of address space. If you reserve 2GiB for datasize (sbrk), there's less than 1GiB available for mmap. Unless you have a program that still uses sbrk and needs 2GiB you should make maxdsiz much smaller. Since FreeBSD 7 malloc can use mmap besides sbrk so you can set maxdsiz to a really small value if you want to.