It is unfortunate that a lot of people don't understand the UNIX memory
model. Unfortunately this is helped by tools like ps which are not able
to provide accurate information about memory usage. In UNIX a process
uses basically three kinds of memory segments: shared memory segments,
code segments and data segments.
Shared memory is used by shared libraries. This memory is shared by all processes which use a certain library. Unfortunately there is no easy way to determine how much shared memory is used by how many processes. So a process can use 10Mb of shared memory, but you don't know whether this memory is shared with 1, 2 or 10 processes. So if you have 10 processes who each use 10Mb of shared memory this actually requires 10Mb in the best case and 100Mb in the worst case.
Code segments contain the actual executable code of your program. This memory is shared by all processes of this same program. If you start your program 5 times, it needs to load the code segment of your program only once.
Data segments contain the data of your program. This kind of memory is very important because the data segments of a process are not shared with other processes. Starting the same program 5 times makes that the data segments are 5 times in memory.
The size reported by ps is typically just the numbers for shared, code
and data added. This is not a very accurate representation of the memory
usage of an application.
KDE applications tend to be reported as quite large because the numbers
reported include the size of the shared memory segments. This size is
added to the size of each kde application while in practice the shared
memory segments appear in memory only once. This is rather illusive,
imagine how the output of ps would look like if it included the size of
the UNIX kernel for each process!
Instead of looking at the output of ps you get a better idea of the
actual memory usage of an application by looking at the output of
cat /proc/<pid-of-process>/status.
Author: Waldo Bastian