extreme mem usage under amd64 arch ?

Astrodog astrodog at gmail.com
Fri Apr 7 13:28:31 UTC 2006


> > Even consuring to 'downgrade' to 1386 at this moment.
I suppose that would work.

> > it this do-able  on this amd system, a build world , would i be able to
> > do a install world/kernels without crashing on the way???
Not really.

>  > I found out that without php the mem usages is more or less normaal.
>  > no diffs for php4/5 (same big mem usage)
Alright...

Please consider what AMD64 is, exactly, and what it means for
something to be 64-bit, as opposed to 32-bit. On a 32 bit processor,
all ints, and pointers take up 32 bits of memory. So, for every int,
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
applications that use a whole lot of ints, and pointers will use way
more memory on AMD64, than they will on i386.
Here's an example:

int main() {
 int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v,
w, x, y, z;
 void *aa, *bb, *cc;
 return 0;
}

it will use 104 bytes of memory for ints, and 12 bytes of memory for
pointers, on i386. However, on AMD64, the same program will use 208
bytes of memory for ints, and 24 bytes for pointers. This memory usage
is significantly compounded in some complex apps. (Yes, PHP is
complex) Now that above is the BEST CASE scenario. If an application
isn't well written for 64-bit, things can get pretty nasty too. To
make up for this memory gobbling, the processor does get to access
more information at a time, too, so it all kinda evens out
performance-wise.

If you have >= 4GB of memory though, the pain-in-the-ass-ness of PAE,
and how badly it breaks things, makes 64 bit the only choice, for
those of us who don't have a thing for pain.

 --- Harrison Grundy


More information about the freebsd-amd64 mailing list