Tuesday, 3 July 2007

Memory size of X terminal emulators

Ideally I'd like to make do with the smallest applications which do exactly what I need and nothing more. In particular lets consider the memory footprint of terminal emulators i.e. xterm, mrxvt and my modified mrxvt.
I'll be using a non-debug build (no -g flag), "ls -ash" for the size of the executable and "ldd" to list the dependencies on shared libraries. I'll also be compiling them with Unicode support when possible.

xterm
316K xterm
needs 19 shared libraries
linux-gate.so.1 => (0xffffe000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40019000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4002c000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4014c000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x401bb000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x401c3000)
libXaw.so.8 => /usr/X11R6/lib/libXaw.so.8 (0x401f1000)
libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x4024d000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40264000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x40272000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x402c5000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x402cd000)
libncurses.so.5 => /lib/libncurses.so.5 (0x402e5000)
libc.so.6 => /lib/tls/libc.so.6 (0x4032a000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x40444000)
libdl.so.2 => /lib/libdl.so.2 (0x40463000)
libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x40467000)
libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x40477000)
/lib/ld-linux.so.2 (0x40000000)

mrxvt with most options enabled
428K mrxvt
needs 18 shared libraries
linux-gate.so.1 => (0xffffe000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40019000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4002c000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4014c000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x401bb000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x401c3000)
libpng.so.3 => /usr/lib/libpng.so.3 (0x401f1000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x4021f000)
libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x4023f000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4024f000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40267000)
libz.so.1 => /lib/libz.so.1 (0x4026f000)
libm.so.6 => /lib/tls/libm.so.6 (0x40280000)
libc.so.6 => /lib/tls/libc.so.6 (0x402a3000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x403bd000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x403cb000)
libdl.so.2 => /lib/libdl.so.2 (0x403ea000)
/lib/ld-linux.so.2 (0x40000000)

My modified mrxvt
324K mrxvt
needs 15 shared libraries
linux-gate.so.1 => (0xffffe000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40019000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4002c000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x4014c000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x401bb000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x401c3000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x401f1000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40209000)
libz.so.1 => /lib/libz.so.1 (0x40212000)
libm.so.6 => /lib/tls/libm.so.6 (0x40223000)
libc.so.6 => /lib/tls/libc.so.6 (0x40246000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4035f000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x4036d000)
libdl.so.2 => /lib/libdl.so.2 (0x4038c000)
/lib/ld-linux.so.2 (0x40000000)

By looking at my dependencies you may realise that I've removed a lot of visual features such as background png, jpeg support and transparency. I've also removed other stuff like some of the buttons that I deemed unnecessary.

Although the size of the executable plus the number of dependencies gives some idea at how much memory each application at runtime it's hard to put an exact figure as the programs don't run isolated.

Anyway my mission will be to once again make sure I only use the shared libraries I really need.

No comments: