Freebsd – How to understand the “SIZE” output of the command top on FreeBSD

freebsdtop

I am working on a VPS with 512 of RAM, I installed mysql, run the command top and found that the value of SIZE for mysql is 638M:

last pid:  2023;  load averages:  0.17,  0.19,  0.21                                                                                              up 0+03:05:43  19:26:01
27 processes:  1 running, 26 sleeping
CPU:  0.4% user,  0.0% nice,  1.2% system,  0.0% interrupt, 98.4% idle
Mem: 60M Active, 216M Inact, 94M Wired, 59M Buf, 104M Free
Swap: 1024M Total, 1024M Free

  PID USERNAME       THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
 1324 mysql           30  20    0   638M   168M uwait    2:12   0.00% mysqld

From the man page I got this:

SIZE is the total size of the process (text, data, and stack)

Having only 512M of RAM on the VPS, I though I was consuming all memory but based on the MEM line seems that not:

Mem: 60M Active, 216M Inact, 94M Wired, 59M Buf, 104M Free

Therefore I would like to know what more detail how the SIZE and RES are calculated and how to properly interpret them.

Best Answer

What you are looking for is the RES column, which is the actual memory (RAM) used by the process. SIZE also includes files that are maped by the process (so if those are large SIZE goes up, but the files are still stored on you hard drive).