From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 9 20:04:48 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 705A216A41F for ; Fri, 9 Dec 2005 20:04:48 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03AA243D5D for ; Fri, 9 Dec 2005 20:04:48 +0000 (GMT) (envelope-from babkin@verizon.net) Received: from vms070.mailsrvcs.net ([192.168.1.3]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IR800LZUYC1EXF1@vms048.mailsrvcs.net> for freebsd-hackers@freebsd.org; Fri, 09 Dec 2005 14:02:25 -0600 (CST) Date: Fri, 09 Dec 2005 14:02:25 -0600 (CST) From: Sergey Babkin To: Divacky Roman , freebsd-hackers@freebsd.org Message-id: <10939303.1134158545675.JavaMail.root@vms070.mailsrvcs.net> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailman-Approved-At: Fri, 09 Dec 2005 20:39:13 +0000 Cc: Subject: Re: Re: sysctl, HW_PHYSMEM, and crippled gcc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: babkin@users.sf.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2005 20:04:48 -0000 >From: Divacky Roman >On Thu, Dec 08, 2005 at 05:06:16PM -0800, Steve Kargl wrote: >> Anyone have any insight into fixing gcc to make better >> use of system memory on systems with more than 4 GB. >> It appears that libiberty/physmem.c tries to use sysctl() >> to determine the amount of physical memory in a system. >> >> { /* This works on *bsd and darwin. */ >> unsigned int physmem; >> size_t len = sizeof physmem; >> static int mib[2] = { CTL_HW, HW_PHYSMEM }; >> >> if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0 >> && len == sizeof (physmem)) >> return (double) physmem; >> } >> >> This works if you have less than 4GB because of the unsigned >> int physmem. I have 12 GB, which of course, when expanded >> to the number of bytes doesn't fit into a unsigned int physmem. >> In particular, ggc-min-heapsize=4096 is ridiculously small for a >> system with 12 GB of memory. > >the code works here (512M of memory)... dont know about the ifdefs its >surrounded by.. I guess you've confused M and G :-) The point is that it breaks with over 4G of memory. -SB