you can find out where all that memory's going using my handy pmap utility. Grab it from http://web.mr-happy.com/~adi/pmap.c then compile it and run
pmap `pidof X`
or
pmap `pidof XFree86`
and you'll get a nicely formatted map showing you what memory your X server is using. Here's a example, from a Matrox II PCI not using DRI:
/opt/XFree86/bin/X(232) 08048000 (1260 KB) r-xp (08:06 201038) /usr/local/opt/XFree86/bin/XFree86 08183000 (180 KB) rw-p (08:06 201038) /usr/local/opt/XFree86/bin/XFree86 081b0000 (3984 KB) rwxp (00:00 0) 40000000 (72 KB) r-xp (08:01 8494) /lib/ld-2.1.2.so 40012000 (4 KB) rw-p (08:01 8494) /lib/ld-2.1.2.so 40013000 (4 KB) rwxp (00:00 0) 40014000 (16 KB) rw-s (08:01 8523) /dev/mem 40019000 (112 KB) r-xp (08:01 8812) /lib/libm-2.1.2.so 40035000 (4 KB) rw-p (08:01 8812) /lib/libm-2.1.2.so 40036000 (8 KB) r-xp (08:01 8811) /lib/libdl-2.1.2.so 40038000 (8 KB) rw-p (08:01 8811) /lib/libdl-2.1.2.so 4003a000 (848 KB) r-xp (08:01 8806) /lib/libc-2.1.2.so 4010e000 (16 KB) rw-p (08:01 8806) /lib/libc-2.1.2.so 40112000 (16 KB) rw-p (00:00 0) 40116000 (4096 KB) rw-s (08:01 8523) /dev/mem 40516000 (8192 KB) rw-s (08:01 8523) /dev/mem 40d16000 (64 KB) rw-s (08:01 8523) /dev/mem 40d26000 (176 KB) rw-p (00:00 0) 40d58000 (3308 KB) rw-p (00:00 0) bfff2000 (56 KB) rwxp (00:00 0) mapped: 22424 KB writable/private: 7756 KB shared: 12368 KB
The first two segments are the binary; the next is the heap (probably), then some libraries and other miscellaneous mappings, then the several large /dev/mem mappings are the device registers and frame buffer.
The interesting number for measuring impact on available physical memory is the last line, "7756 KB writable/private". Although "top" claims that X is taking up 20MB with a RSS of 16MB, in fact there's only 8MB of physical memory allocated (approximately). (I'm pretty sure top counts device mappings as part of RSS.)
I'm leaving out a bunch of nuance here, but that's the gist of the matter. It's also interesting to explore how programs that look big (like xterm) actually are mostly using shared mappings.
andy
http://www.xfree86.org/pipermail/xpert/2000-September/001331.html
documented on: 2001.03.13 Tue 00:10:58