The RSS column from ps (or the RES column in top) is the nearest to “physical” memory actually used by a process:

Julia Evans, aka @b0rk has a great post about how memory works under Linux.

I wanted to see it in MB rather than the default kB. This superuser answer shows how, using the nifty numft. It will convert from the kilobyte size and produce a human-readable output:

ps -o rss 24652 | numfmt --header --to=iec --field 1 --from-unit=1024

In my case PID 24652 was a greedy 2.8G, converting from the RSS size of 2935448.

If it had been smaller, say an RSS of 232 then numfmt automatically adjusts its units and reports this as 232K.

I’m helping numfmt know that the input size is in kB with the --from-unit=1024. Converting values from a different process might not need this, but be wary of decimal versus binary scales:

echo "1M" | numfmt --from=iec --to=iec
echo "1M" | numfmt --from=si --to=iec

Pádraig Brady and Assaf Gordon have a thorough look at what you can do with numfmt.