For example: i get whole top(1) table with `top -bS 1000 > toptest`
Now, i count sum for column SIZE = 3016M
sum for RES = 621M
(note: i have only 512M RAM with nearly 104M swap used)
So about top(1) AFAIK
RES = Process size minus swapped out pages. In other words, this should be exactly "amount of memory(RAM) using by process".
SIZE = Virtual memory used by process. This is RAM used + swap used + shared libs. Note if 2 process share same libs, they will count in both SIZE's, so just sum them is not right.