Linux Help:Tip of the Day:Discovering the Real Memory Usage of a Process

From TLUG Wiki

Jump to: navigation, search

mailing list link

ps -lyu <your_username>

By default, top(1) shows the virtual and resident memory sizes of processes, which is a little misleading, in that shared libraries are counted over and over again, painting a scarier picture of memory usage than the actual situation. Thanks to a comment attached to a very useful entry in a very useful blog, I discovered the above invocation of ps(1), which will list, in the "SZ" column, the size of the process itself, discounting shared libraries and such.

For more details on all of this, see the blog entry itself.

For more details on what ps(1)'s "SZ" column is really representing, search the manpage for '^size':

size       SZ       approximate amount of swap space that would be required if
                    the process were to dirty all writable pages and then be
                    swapped out. This number is very rough!

Cheers, Josh

Personal tools