For the moment I have to cope with a low-memory machine at home, so I decided to switch it from KDE to XFCE. But is it really worth it, in terms of memory savings? I decided to measure…
First of all, I’m not trying to do rigorous analysis here but just do some estimates to make a decision for personal use. Still, if you find something in my method which invalidates the results I obtained, I’d be glad to know about it.
To know the memory consumption of each desktop system, I simply started a fresh session in that desktop, opened a terminal and obtained a process listing with ps -e. No other program was opened at the time. Because I did this using a new user account, the test was made with the default configuration and default loaded programs of each desktop system.
Since the important figure in the ps output is the RSS (resident set size) column, I also turned off the swap partition in my computer. The ps manpage says that the RSS field doesn’t count swapped memory from the process. Good thing I noticed this before it was too late!
Here is the result for KDE:
And here is the result for XFCE:
|/bin/sh /etc/xdg/xfce4/xinitrc — /etc/X11/xinit/xserverrc||4,292||1,444|
So, XFCE uses 152MB of RAM, versus the 191MB KDE uses. Not bad, almost 40MB (20%) less!
That’s not the whole story, though. I also wrote down the output of the
free command as a sanity check.
Look at the “used” column, in the “-/+ buffers/cache” line. That is the actual memory amount being used by the running programs in the computer.
This is a very interesting and surprising result: at the end of the day, XFCE actually uses more memory than KDE! Why, if adding up the resident sizes of the processes from each desktop system you get a different conclusion?
One explanation would be that KDE actually shares more memory between processes than XFCE. Its programs most probably have a greater number of shared libraries in common, which enables the kernel to use the same memory pages for the text section of those libraries accross process images. Unfortunately I didn’t collect data to test that possibility, and it’s late at night now. But it makes sense.
The bottom line, surprisingly enough, is that you should stick with KDE to preserve memory. Or switch to a bare-bones window manager instead of a complete desktop system, like IceWM, Window Maker, Blackbox or something else. But I’m too spoiled by the amenities of a good desktop to do that.
By the way, the tests were made with KDE 3.5.8 and XFCE 4.4.2 under Debian GNU/Linux unstable (updated on 2008/01/06) on a 32-bit x86 machine.