This question is covered here in great detail.
How do you measure the memory usage of an application or process in Linux?
From the blog articl
I am using Arch Linux and there's this wonderful package called ps_mem
:
ps_mem -p
$ ps_mem -S -p $(pgrep firefox)
Private + Shared = RAM used Swap used Program
355.0 MiB + 38.7 MiB = 393.7 MiB 35.9 MiB firefox
---------------------------------------------
393.7 MiB 35.9 MiB
=============================================