Understanding memory management

Random, this morning, with if ( -x /usr/bin/fortune ) /usr/bin/fortune freebsd-tips in my ~./login:

To learn more about what your system is doing, take a look at systat(1). For example, to get various statistics related to virtual memory usage, process scheduling, device interrupts, system name translation caching, and disk I/O, enter the following:

systat -vmstat

Other values are icmp, icmp6, ifstat, iostat, ip, ip6, netstat, pigs, sctp, swap, tcp, or zarc. You can switch between displays using :<display> and exit back to your shell by typing

:quit

-- Benedict Reuschling <bcr@…>

systat -vmstat

Code:
    8 users    Load  5.85  3.79  4.85                  13 Apr 08:43:36
   Mem usage:  98%Phy 16%Kmem                           VN PAGER   SWAP PAGER
Mem:      REAL           VIRTUAL                        in   out     in   out
       Tot   Share     Tot    Share     Free   count     3                 59
Act  8020M    310M    584G     911M     345M   pages    19                663
All  8044M    334M    585G    1039M                     3 ioflt  Interrupts
Proc:                                                4688 cow    4082 total
  r   p   d    s   w   Csw  Trp  Sys  Int  Sof  Flt   18K zfod        atkbd0 1
  2      20  962       32K  27K 138K  589       24K       ozfod       acpi0 9
                                                         %ozfod    95 ehci0 ehci
13.9%Sys   0.0%Intr 34.8%User  0.1%Nice 51.2%Idle     13K daefr   919 cpu0:timer
|    |    |    |    |    |    |    |    |    |    |   19K prcfr   850 cpu1:timer
=======>>>>>>>>>>>>>>>>>                              44K totfr   854 cpu2:timer
                                           dtbuf      946 react   870 cpu3:timer
Namei     Name-cache   Dir-cache    348278 maxvn          pdwak       hdac0 32
   Calls    hits   %    hits   %    348278 numvn      27K pdpgs   195 xhci0 33
  502668  431485  86                160606 frevn       40 intrn     1 em0:irq0
                                                    2976M wire        hdac1 36
Disks  ada0   da0   da1 pass0 pass1 pass2 pass3     8242M act      43 iwn0 37
KB/t  59.13  6.74  5.64  0.00  0.00  0.00  0.00     3228M inact   188 ahci0 38
tps     188    13     7     0     0     0     0      885M laund    67 vgapci0 39
MB/s  10.87  0.08  0.04  0.00  0.00  0.00  0.00      345M free
%busy    51     2     0     0     0     0     0         0 buf

:swap

… a few minutes later:

Code:
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   |||||||||||

Device/Path       Size  Used |0%  /10  /20  /30  /40  / 60\  70\  80\  90\ 100|
ada0p2.eli         16G 2968K

Pid    Username   Command     Swap/Total Per-Process    Per-System
 19592 grahamperrin firefox    3M /  14G  0%              0%
 20766 grahamperrin firefox  284K /   3G  0%              0%

… later, in xterm:

1649838599170.png

… bugged after a few hours in xterm:

1649869564996.png

– so I :quit then ran systat -swap:

Code:
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||||||

Device/Path       Size  Used |0%  /10  /20  /30  /40  / 60\  70\  80\  90\ 100|
ada0p2.eli         16G  844M XX

Pid    Username   Command     Swap/Total Per-Process    Per-System
 19592 grahamperrin firefox  163M /  15G  1%              0%
 22023 grahamperrin firefox  155M /   9G  1%              0%
  3185 grahamperrin mysqld   127M / 472M 26% XX           0%
  3203 grahamperrin java      82M /   6G  1%              0%
  3089 grahamperrin plasmashe 17M / 797M  2%              0%
  3212 grahamperrin python3.8 16M / 222M  7%              0%
 33861 grahamperrin firefox   15M /   3G  0%              0%
  3229 grahamperrin python3.8 15M /  67M 22% XX           0%
  3230 grahamperrin python3.8 14M /  54M 25% XX           0%
  3118 grahamperrin kgpg      13M / 349M  3%              0%
  3085 grahamperrin kwin_x11   7M / 758M  0%              0%
  3107 grahamperrin xterm      5M /  25M 20% XX           0%
 20766 grahamperrin firefox    5M /   3G  0%              0%
  3084 grahamperrin kded5      5M / 233M  2%              0%
 57873 grahamperrin recollind  4M / 128M  3%              0%
  3086 grahamperrin ksmserver  3M / 145M  2%              0%
  3198 grahamperrin xterm      3M /  25M 11% X            0%
  3139 grahamperrin korgac     3M / 215M  1%              0%
  3061 grahamperrin startplas  3M / 117M  2%              0%
  3074 grahamperrin plasma_se  2M / 117M  2%              0%
  3076 grahamperrin kdeinit5   2M / 118M  2%              0%
  3095 grahamperrin DiscoverN  2M / 169M  1%              0%
 82438 grahamperrin dolphin    2M / 415M  0%              0%
  3091 grahamperrin org_kde_p  2M / 144M  1%              0%
 81314 grahamperrin code-oss   2M /  49G  0%              0%
  3136 grahamperrin kscreen_b  2M /  90M  1%              0%
  3178 grahamperrin akonadi_c  2M / 139M  1%              0%
  3077 grahamperrin klauncher  2M / 134M  1%              0%
  3179 grahamperrin akonadise  2M / 188M  0%              0%
  3224 grahamperrin gvfs-udis  1M /  60M  2%              0%
  3092 grahamperrin kaccess    1M / 282M  0%              0%
 81312 grahamperrin code-oss   1M /  41G  0%              0%
  3088 grahamperrin kglobalac  1M / 141M  0%              0%
  3102 grahamperrin kactivity  1M / 144M  0%              0%
  3143 grahamperrin at-spi-bu  1M /  47M  2%              0%
 81302 grahamperrin code-oss   1M /  49G  0%              0%
  3094 grahamperrin xembedsni  1M /  91M  1%              0%
  3111 grahamperrin dconf-ser  1M /  31M  3%              0%
  3226 grahamperrin gvfs-mtp-  1M /  36M  3%              0%
  3099 grahamperrin gmenudbus  1M / 101M  1%              0%
  3096 grahamperrin kdeconnec  1M / 268M  0%              0%
  3148 grahamperrin at-spi2-r  1M /  36M  2%              0%
  3186 grahamperrin gkrellm  944K / 143M  0%              0%
 81898 grahamperrin firefox  564K /   3G  0%              0%
  3016 grahamperrin ck-launch520K /  16M  3%              0%
  3134 grahamperrin gstat    424K /  14M  3%              0%
  3218 grahamperrin ibus-daem420K /  51M  0%              0%
  3138 grahamperrin gvfsd    412K /  45M  0%              0%
  3059 grahamperrin dbus-run-396K /  13M  2%              0%
  3216 grahamperrin autorandr388K /  13M  2%              0%
  3144 grahamperrin dbus-daem340K /  14M  2%              0%
  3206 grahamperrin java     304K /   6G  0%              0%
  3060 grahamperrin dbus-daem296K /  16M  1%              0%
  3331 grahamperrin akonadi_e188K / 617M  0%              0%



Disks  ada0   da0   da1 pass0 pass1 pass2 pass3
KB/t  14.88 21.50  4.12  0.00  0.00  0.00  0.00
tps      18     1     1     0     0     0     0
MB/s   0.26  0.01  0.00  0.00  0.00  0.00  0.00
%busy     8     0     0     0     0     0     0
Showing swap, refresh every 5 seconds.

The xterm view is incomplete, compared to Konsole:

1649869945856.png

Uptime 16:30,

Code:
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||||

Device/Path       Size  Used |0%  /10  /20  /30  /40  / 60\  70\  80\  90\ 100|
ada0p2.eli         16G 3544M XXXXXXXXXX

Pid    Username   Command     Swap/Total Per-Process    Per-System
 19592 grahamperrin firefox  465M /  16G  2%              2%
 22023 grahamperrin firefox  349M /   9G  3%              2%
  3203 grahamperrin java     258M /   6G  4%              1%
  3185 grahamperrin mysqld   167M / 472M 35% XXX          1%
 11247 grahamperrin firefox  155M /   3G  5%              0%
  9786 grahamperrin firefox  132M /   3G  4%              0%
  3089 grahamperrin plasmashe115M / 807M 14% X            0%
 81312 grahamperrin code-oss 104M /  41G  0%              0%
  9940 grahamperrin firefox  100M /   3G  3%              0%
 81898 grahamperrin firefox   98M /   3G  3%              0%
 11060 grahamperrin firefox   92M /   3G  3%              0%
  3206 grahamperrin java      87M /   6G  1%              0%
  3085 grahamperrin kwin_x11  66M / 757M  8%              0%
 81308 grahamperrin code-oss  63M /  59G  0%              0%
 81302 grahamperrin code-oss  59M /  49G  0%              0%
 10957 grahamperrin firefox   39M /   3G  1%              0%
 62485 grahamperrin gam_serve 37M /  55M 68% XXXXXX       0%
 81314 grahamperrin code-oss  30M /  49G  0%              0%
 57873 grahamperrin recollind 28M / 128M 21% XX           0%
 82438 grahamperrin dolphin   26M / 415M  6%              0%
 81304 grahamperrin code-oss  26M / 626M  4%              0%
  3212 grahamperrin python3.8 25M / 222M 11% X            0%
 77377 grahamperrin spectacle 23M / 523M  4%              0%
  3229 grahamperrin python3.8 22M /  67M 33% XXX          0%
  3389 grahamperrin konsole   19M / 378M  5%              0%
  3230 grahamperrin python3.8 19M /  54M 34% XXX          0%
 25772 grahamperrin firefox   16M /   3G  0%              0%
  3287 grahamperrin ibus-exte 14M /  96M 14% X            0%
  3381 grahamperrin kwalletma 14M / 343M  4%              0%
  3118 grahamperrin kgpg      14M / 349M  3%              0%
 20766 grahamperrin firefox   13M /   3G  0%              0%
  3233 grahamperrin kwalletd5 13M / 341M  3%              0%
 81316 grahamperrin code-oss  13M /  40G  0%              0%
 81318 grahamperrin code-oss  11M /  40G  0%              0%
  3179 grahamperrin akonadise  9M / 188M  4%              0%
  3211 grahamperrin evolution  9M / 245M  3%              0%
  3084 grahamperrin kded5      7M / 233M  2%              0%
  3186 grahamperrin gkrellm    6M / 143M  4%              0%
  3337 grahamperrin akonadi_m  6M / 653M  0%              0%
  3328 grahamperrin akonadi_a  6M / 647M  0%              0%
  3342 grahamperrin akonadi_u  6M / 640M  0%              0%
  3332 grahamperrin akonadi_f  6M / 644M  0%              0%
  3338 grahamperrin akonadi_m  6M / 640M  0%              0%
  3341 grahamperrin akonadi_s  6M / 640M  0%              0%
 27897 grahamperrin firefox    6M /   3G  0%              0%
  3107 grahamperrin xterm      5M /  25M 20% XX           0%
  3331 grahamperrin akonadi_e  5M / 617M  0%              0%
  3357 grahamperrin evolution  5M / 130M  3%              0%
   883 grahamperrin gtk-mixer  5M / 640M  0%              0%
  3351 grahamperrin evolution  5M / 132M  3%              0%
  3092 grahamperrin kaccess    4M / 282M  1%              0%
  3360 grahamperrin evolution  4M / 149M  2%              0%



Disks  ada0   da0   da1 pass0 pass1 pass2 pass3
KB/t  14.65  0.00  0.00  0.00  0.00  0.00  0.00
tps      19     0     0     0     0     0     0
MB/s   0.27  0.00  0.00  0.00  0.00  0.00  0.00
%busy     8     0     0     0     0     0     0
Showing swap, refresh every 5 seconds.
 
Additionally (as a supplement), classic explanation of "How BSD memory works " (on example of a stack of network protocols) contained in "TCP/IP Illustrated Volume 2, by W. Richard Stevens and Gary R. Wright".
 
Back
Top