From owner-freebsd-amd64@FreeBSD.ORG Fri Apr 7 21:16:40 2006 Return-Path: X-Original-To: freebsd-amd64@FreeBSD.ORG Delivered-To: freebsd-amd64@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4728216A401 for ; Fri, 7 Apr 2006 21:16:40 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6AEB443D45 for ; Fri, 7 Apr 2006 21:16:39 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (wdixgp@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k37LGWv5071638; Fri, 7 Apr 2006 23:16:37 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k37LGQhQ071637; Fri, 7 Apr 2006 23:16:26 +0200 (CEST) (envelope-from olli) Date: Fri, 7 Apr 2006 23:16:26 +0200 (CEST) Message-Id: <200604072116.k37LGQhQ071637@lurza.secnetix.de> From: Oliver Fromme To: freebsd-amd64@FreeBSD.ORG, John-Mark Gurney In-Reply-To: <20060407172618.GC72485@funkthat.com> X-Newsgroups: list.freebsd-amd64 User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 07 Apr 2006 23:16:38 +0200 (CEST) Cc: Subject: Re: extreme mem usage under amd64 arch ? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-amd64@FreeBSD.ORG, John-Mark Gurney List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2006 21:16:40 -0000 John-Mark Gurney wrote: > Astrodog wrote this message on Fri, Apr 07, 2006 at 21:28 +0800: > > and pointer, you use 4 Bytes. On a 64-bit processor, all ints, and > > pointers take up 64-bits of memory. So, for every int and pointer, you > > use 8 bytes. (Assuming its a 64-bit app, of course) That means > > Not quite... FreeBSD/amd64 like all? the other arches are LP64... > that means longs and pointers are 64bits, while ints remain at 32bits... I think longs are 32 bits on /i386, and 64 bits on /amd64 (On /i386, "long longs" are 64 bits.) A programmer should not rely on specific sizes of longs, ints etc. anyway. In particular, he should not assume that a long is larger than an int, that a pointer has the same size as an int or a long, and similar things. If a specific size is needed, then one of the standard types int64_t, int32_t etc. should be used which are defined appropriately by the OS. Or, or course, use a higher-level programming language where you don't have to care about integer sizes at all, such as Python ("print 999**999" will fill the screen nicely). ;-) > This was primarily done because too many people assumed ints were > 32bits for things like disk structures and network protocol layout, > and to break less code, LP64 was decided upon... I guess this is the most important reason: If ints were 64 bits, there would be no easy way to handle 32 bit entities. Not being able to handle 32 bit objects with a native data type whould be a major problem, especially for an OS kernel, I think. Best regards Oliver PS: The random quote in my signature below fits pretty well. It really is random, I swear. :-) -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "C is quirky, flawed, and an enormous success." -- Dennis M. Ritchie.