extreme mem usage under amd64 arch ?

Oliver Fromme olli at lurza.secnetix.de
Fri Apr 7 21:16:40 UTC 2006


John-Mark Gurney <gurney_j at resnet.uoregon.edu> 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.


More information about the freebsd-amd64 mailing list