You are not logged in.

#1 2011-05-02 14:42:07

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

The memory usage statistics thread

Hello people.

I was reading about memory usage here:

http://kmandla.wordpress.com/2009/08/29 … ory-usage/

and found this nice python script:

https://github.com/pixelb/ps_mem

Use it as root with python2, like this

# python2 ./ps_mem.py

Here's the result for my system.

Private  +   Shared  =  RAM used    Program 

 80.0 KiB +  20.5 KiB = 100.5 KiB    init
 96.0 KiB +  16.5 KiB = 112.5 KiB    atd
100.0 KiB +  18.0 KiB = 118.0 KiB    tail
108.0 KiB +  25.0 KiB = 133.0 KiB    crond
116.0 KiB +  37.0 KiB = 153.0 KiB    agetty (2)
144.0 KiB +  35.5 KiB = 179.5 KiB    su
160.0 KiB +  35.5 KiB = 195.5 KiB    sudo
212.0 KiB +  40.0 KiB = 252.0 KiB    dbus-launch
212.0 KiB +  65.5 KiB = 277.5 KiB    unclutter
276.0 KiB +  82.0 KiB = 358.0 KiB    dwm
452.0 KiB +  28.0 KiB = 480.0 KiB    dbus-daemon
500.0 KiB +  66.0 KiB = 566.0 KiB    htop
696.0 KiB +  99.0 KiB = 795.0 KiB    xscreensaver
272.0 KiB + 548.5 KiB = 820.5 KiB    udevd (3)
684.0 KiB + 250.0 KiB = 934.0 KiB    conky
892.0 KiB +  58.0 KiB = 950.0 KiB    xbindkeys
716.0 KiB + 357.5 KiB =   1.0 MiB    syslog-ng (2)
816.0 KiB + 499.0 KiB =   1.3 MiB    gconfd-2
  1.1 MiB + 370.5 KiB =   1.5 MiB    slim
  1.6 MiB + 146.5 KiB =   1.8 MiB    mc
  3.1 MiB + 154.5 KiB =   3.2 MiB    mutt
  6.3 MiB +  97.5 KiB =   6.4 MiB    iftop
  6.5 MiB + 460.0 KiB =   6.9 MiB    rtorrent
  4.9 MiB +   2.7 MiB =   7.7 MiB    gvim
 10.4 MiB + 328.5 KiB =  10.7 MiB    urxvtd
 20.8 MiB + 209.0 KiB =  21.0 MiB    screen-4.0.3 (3)
 32.1 MiB + 383.0 KiB =  32.4 MiB    Xorg
 42.7 MiB +   1.3 MiB =  44.0 MiB    bash (14)
157.7 MiB +   3.1 MiB = 160.7 MiB    firefox
---------------------------------
                        305.0 MiB
=================================

 Private  +   Shared  =  RAM used    Program 

I know that firefox is a resource hog, so i wasn't too surprised by its usage. But i was surprised by bash and xorg's memory usage. Is bash supposed to eat so much memory? I am running a number of terminal apps, but still bash's usage seems too high. Most of these programs are started via .xinitrc. Can switching to sh instead of bash help? Also, can i reduce xorg's memory usage. Other than that everything seems fine.

I am curious about my fellow arch users' memory stats. So bring it on, and also tell how you people optimize your memory usage.

Edit: Updated Link to the script

Last edited by x33a (2013-09-26 16:32:13)

Offline

#2 2011-05-02 15:16:44

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 858
Website

Re: The memory usage statistics thread

xorg has to allocate some memory for each control that appears on the screen.  Its memory usage would probably be less if you closed a bunch of programs.  And I don't think that 3.05MiB per bash session is that much.  I'll post mine in a second, but right now VirtualBox is taking up 6.2GiB of memory which kind of dwarfs everything else smile

Offline

#3 2011-05-02 16:17:00

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: The memory usage statistics thread

If you don't need an interactive shell or bash-only features (like arrays), use dash.

https://bbs.archlinux.org/viewtopic.php … 32#p786332

[karol@black ~]$ shellram dash
COUNT: 6
RESIDENT: 2 MB
VIRTUAL: 11 MB
[karol@black ~]$ shellram bash
COUNT: 2
RESIDENT: 4 MB
VIRTUAL: 12 MB
[karol@black ~]$ type shellram
shellram is a function
shellram () 
{ 
    local shell=$1;
    ps -C $shell -o rss= -o vsize= -o cmd= | awk '{rss+=$1;virt+=$2}END {
  print "COUNT: " NR;
  print "RESIDENT: " int(rss/1024) " MB";
  print "VIRTUAL: " int(virt/1024) " MB"}'
}

Last edited by karol (2011-05-02 16:18:27)

Offline

#4 2011-05-02 17:39:50

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The memory usage statistics thread

karol wrote:

If you don't need an interactive shell or bash-only features (like arrays), use dash.

https://bbs.archlinux.org/viewtopic.php … 32#p786332

[karol@black ~]$ shellram dash
COUNT: 6
RESIDENT: 2 MB
VIRTUAL: 11 MB
[karol@black ~]$ shellram bash
COUNT: 2
RESIDENT: 4 MB
VIRTUAL: 12 MB
[karol@black ~]$ type shellram
shellram is a function
shellram () 
{ 
    local shell=$1;
    ps -C $shell -o rss= -o vsize= -o cmd= | awk '{rss+=$1;virt+=$2}END {
  print "COUNT: " NR;
  print "RESIDENT: " int(rss/1024) " MB";
  print "VIRTUAL: " int(virt/1024) " MB"}'
}

Hmm.. can i use dash for .xinitrc?

I have a bit complex setup. My xinitrc spawns 2 urxvtc, then in one terminal i use screen (which opens 2 interactive shells and a few other programs), and in another terminal, i use screen -x.

So i don't know how i can separate bash and dash. I guess, i'll have to stick to bash only.

Offline

#5 2011-05-02 17:47:55

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: The memory usage statistics thread

I use dash as my default shell. If I need bash, I simply type 'bash' at the prompt of my (tabbed) urxvtc. I'm not sure if you know but you can use e.g. htop w/o any shell:

urxvtcd -e htop

On the other hand, is it really worth the trouble? :-)

Offline

#6 2011-05-02 17:55:42

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The memory usage statistics thread

karol wrote:

I use dash as my default shell. If I need bash, I simply type 'bash' at the prompt of my (tabbed) urxvtc. I'm not sure if you know but you can use e.g. htop w/o any shell:

urxvtcd -e htop

On the other hand, is it really worth the trouble? :-)

Yeah, i know that programs can be launched without a shell. But i am unsure as to how i can launch my screen programs without a shell?

I guess it's not really worth the trouble. Moreover, i have 1 GB ram, so i am not short on memory. I just prefer efficient programs tongue

Offline

#7 2011-05-03 01:50:25

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: The memory usage statistics thread

 Private  +   Shared  =  RAM used    Program 

128.0 KiB +  23.5 KiB = 151.5 KiB    init
188.0 KiB +  17.5 KiB = 205.5 KiB    dhcpcd
188.0 KiB +  46.5 KiB = 234.5 KiB    xinit
280.0 KiB +  39.0 KiB = 319.0 KiB    dbus-launch
392.0 KiB +  51.5 KiB = 443.5 KiB    sudo
452.0 KiB + 122.5 KiB = 574.5 KiB    agetty (5)
448.0 KiB + 138.0 KiB = 586.0 KiB    startx
524.0 KiB +  75.0 KiB = 599.0 KiB    login
412.0 KiB + 312.0 KiB = 724.0 KiB    dbus-daemon (2)
660.0 KiB +  83.0 KiB = 743.0 KiB    sshd
804.0 KiB +  51.0 KiB = 855.0 KiB    screen-4.0.3
832.0 KiB + 630.0 KiB =   1.4 MiB    udevd (3)
  1.5 MiB + 114.5 KiB =   1.6 MiB    nmbd
  1.3 MiB + 512.5 KiB =   1.8 MiB    syslog-ng (2)
  1.2 MiB + 614.0 KiB =   1.8 MiB    bmpanel2
  2.1 MiB + 709.0 KiB =   2.8 MiB    openbox
  1.6 MiB +   1.2 MiB =   2.8 MiB    parcellite
  1.6 MiB +   1.5 MiB =   3.1 MiB    smbd (2)
  3.3 MiB + 937.5 KiB =   4.2 MiB    bash (5)
  6.9 MiB + 543.5 KiB =   7.5 MiB    urxvtd
  5.9 MiB +   1.7 MiB =   7.7 MiB    conky (4)
  7.4 MiB + 948.5 KiB =   8.4 MiB    weechat-curses
  5.0 MiB +   3.9 MiB =   8.8 MiB    qtfm
 20.9 MiB +   3.5 MiB =  24.4 MiB    pidgin
 52.0 MiB + 646.5 KiB =  52.6 MiB    Xorg
 68.6 MiB +   4.1 MiB =  72.7 MiB    qbittorrent
 83.5 MiB +  21.2 MiB = 104.7 MiB    chromium (4)
---------------------------------
                        311.7 MiB
=================================

 Private  +   Shared  =  RAM used    Program 

There's not really much I can do to optimize it further without sacrificing apps I like. I just wish Xorg would stay down, for some reason everyone's Xorg uses less memory than mine...

Online

#8 2011-05-03 02:03:26

neurolysis
Member
Registered: 2011-02-23
Posts: 112
Website

Re: The memory usage statistics thread

 Private  +   Shared  =  RAM used    Program 

 24.0 KiB +   2.5 KiB =  26.5 KiB    fgetty
104.0 KiB +  72.5 KiB = 176.5 KiB    init
156.0 KiB +  32.0 KiB = 188.0 KiB    dhcpcd
108.0 KiB +  80.0 KiB = 188.0 KiB    crond
124.0 KiB + 106.0 KiB = 230.0 KiB    metalog (2)
392.0 KiB + 138.0 KiB = 530.0 KiB    sudo
612.0 KiB + 116.5 KiB = 728.5 KiB    wpa_supplicant
384.0 KiB + 536.5 KiB = 920.5 KiB    udevd (3)
  1.3 MiB + 131.0 KiB =   1.4 MiB    bash
---------------------------------
                          4.3 MiB
=================================

 Private  +   Shared  =  RAM used    Program 

Offline

#9 2011-05-03 02:37:57

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: The memory usage statistics thread

 Private  +   Shared  =  RAM used    Program 

124.0 KiB +  28.5 KiB = 152.5 KiB    init
188.0 KiB +  76.5 KiB = 264.5 KiB    xinit
400.0 KiB +  64.5 KiB = 464.5 KiB    sudo
456.0 KiB +  32.0 KiB = 488.0 KiB    dbus-daemon
232.0 KiB + 313.5 KiB = 545.5 KiB    ntpd (2)
400.0 KiB + 180.0 KiB = 580.0 KiB    sh
452.0 KiB + 147.5 KiB = 599.5 KiB    agetty (5)
524.0 KiB +  92.0 KiB = 616.0 KiB    login
440.0 KiB + 210.0 KiB = 650.0 KiB    startx
624.0 KiB +  37.5 KiB = 661.5 KiB    crond [updated]
660.0 KiB + 100.0 KiB = 760.0 KiB    sshd
488.0 KiB + 403.0 KiB = 891.0 KiB    avahi-daemon (2)
392.0 KiB + 656.0 KiB =   1.0 MiB    udevd (3)
984.0 KiB +  80.0 KiB =   1.0 MiB    conky
  1.4 MiB +  87.5 KiB =   1.5 MiB    privoxy
  1.5 MiB + 118.5 KiB =   1.6 MiB    xbindkeys
  1.3 MiB + 654.0 KiB =   1.9 MiB    bash (2)
  1.2 MiB + 908.0 KiB =   2.1 MiB    dzen2 (2)
  1.6 MiB + 552.5 KiB =   2.1 MiB    syslog-ng (2)
  3.6 MiB + 239.0 KiB =   3.8 MiB    xmonad-x86_64-linux
  8.1 MiB + 407.0 KiB =   8.5 MiB    cupsd
  8.6 MiB + 581.0 KiB =   9.1 MiB    urxvtd
 10.2 MiB + 378.0 KiB =  10.6 MiB    mpd
 29.2 MiB + 298.5 KiB =  29.5 MiB    Xorg
---------------------------------
                         79.3 MiB
=================================

Pretty nice considering that this machine has 8GB of RAM.

Offline

#10 2013-03-05 20:41:20

andmars
Member
Registered: 2012-03-13
Posts: 362

Re: The memory usage statistics thread

found this nice post and tried the script. Interesting for me was that monsterwm is even more lightweight than dwm and st has a lighter memory footpringt than urxvt.

 Private  +   Shared  =  RAM used	Program 

180.0 KiB +  48.5 KiB = 228.5 KiB	bar
212.0 KiB +  33.5 KiB = 245.5 KiB	dhcpcd
216.0 KiB +  81.5 KiB = 297.5 KiB	dbus-launch
212.0 KiB +  94.5 KiB = 306.5 KiB	xinit
248.0 KiB + 148.5 KiB = 396.5 KiB	monsterwm
428.0 KiB + 176.0 KiB = 604.0 KiB	startx
476.0 KiB + 131.5 KiB = 607.5 KiB	systemd-logind
604.0 KiB + 166.5 KiB = 770.5 KiB	sudo
784.0 KiB +  50.0 KiB = 834.0 KiB	privoxy
660.0 KiB + 236.0 KiB = 896.0 KiB	login
348.0 KiB + 619.0 KiB = 967.0 KiB	sh (2)
536.0 KiB + 476.0 KiB =   1.0 MiB	dbus-daemon (2)
916.0 KiB + 239.5 KiB =   1.1 MiB	ntpd
  1.3 MiB +  88.5 KiB =   1.4 MiB	systemd-udevd
  1.6 MiB + 739.0 KiB =   2.4 MiB	bash (3)
  2.1 MiB + 815.0 KiB =   2.9 MiB	systemd (2)
  3.1 MiB + 338.0 KiB =   3.4 MiB	st
  4.0 MiB + 536.5 KiB =   4.6 MiB	systemd-journald
  9.9 MiB + 581.0 KiB =  10.5 MiB	mpd
 54.7 MiB + 353.5 KiB =  55.0 MiB	Xorg
---------------------------------
                         88.3 MiB
=================================
 Private  +   Shared  =  RAM used	Program 

108.0 KiB +  40.0 KiB = 148.0 KiB	sleep
212.0 KiB +  32.5 KiB = 244.5 KiB	dhcpcd
212.0 KiB +  84.5 KiB = 296.5 KiB	dbus-launch
204.0 KiB +  99.5 KiB = 303.5 KiB	xinit
420.0 KiB + 105.0 KiB = 525.0 KiB	sh
460.0 KiB + 130.5 KiB = 590.5 KiB	systemd-logind
436.0 KiB + 246.0 KiB = 682.0 KiB	startx
468.0 KiB + 285.5 KiB = 753.5 KiB	dwm
604.0 KiB + 165.5 KiB = 769.5 KiB	sudo
784.0 KiB +  49.0 KiB = 833.0 KiB	privoxy
660.0 KiB + 227.0 KiB = 887.0 KiB	login
616.0 KiB + 434.0 KiB =   1.0 MiB	dbus-daemon (2)
916.0 KiB + 233.5 KiB =   1.1 MiB	ntpd
  1.3 MiB +  87.5 KiB =   1.4 MiB	systemd-udevd
  1.2 MiB + 733.0 KiB =   2.0 MiB	bash (2)
  2.5 MiB + 943.0 KiB =   3.5 MiB	systemd (3)
  7.6 MiB + 556.0 KiB =   8.1 MiB	systemd-journald
  8.4 MiB + 532.0 KiB =   8.9 MiB	urxvt
  9.8 MiB + 650.0 KiB =  10.4 MiB	mpd
 53.8 MiB + 314.5 KiB =  54.1 MiB	Xorg
---------------------------------
                         96.4 MiB
=================================

Offline

#11 2013-03-06 04:26:09

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The memory usage statistics thread

Yeah that's why many people are switching over to st.

Offline

#12 2013-03-06 05:04:02

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: The memory usage statistics thread

Those results are ridiculous!  Here's mine:

 Private  +   Shared  =  RAM used	Program 

 80.0 KiB +  10.0 KiB =  90.0 KiB	kwakd
100.0 KiB +  21.5 KiB = 121.5 KiB	wpa_actiond
144.0 KiB +  38.5 KiB = 182.5 KiB	agetty
184.0 KiB +  17.5 KiB = 201.5 KiB	dhcpcd
212.0 KiB +  57.5 KiB = 269.5 KiB	dbus-launch
260.0 KiB +  80.5 KiB = 340.5 KiB	rtkit-daemon
356.0 KiB +  38.5 KiB = 394.5 KiB	lvmetad
296.0 KiB + 114.0 KiB = 410.0 KiB	xautolock
372.0 KiB +  43.5 KiB = 415.5 KiB	loliclip
452.0 KiB + 108.5 KiB = 560.5 KiB	systemd-logind
500.0 KiB + 234.0 KiB = 734.0 KiB	gconfd-2
724.0 KiB +  48.5 KiB = 772.5 KiB	crond
716.0 KiB +  94.0 KiB = 810.0 KiB	sudo
500.0 KiB + 351.5 KiB = 851.5 KiB	redshift
604.0 KiB + 406.0 KiB =   1.0 MiB	gconf-helper
724.0 KiB + 324.5 KiB =   1.0 MiB	bitlbee
972.0 KiB +  80.0 KiB =   1.0 MiB	systemd-udevd
680.0 KiB + 415.5 KiB =   1.1 MiB	dbus-daemon (2)
968.0 KiB + 166.5 KiB =   1.1 MiB	ntpd
  1.0 MiB +  86.0 KiB =   1.1 MiB	wpa_supplicant
672.0 KiB + 775.0 KiB =   1.4 MiB	(sd-pam)
  1.0 MiB + 585.5 KiB =   1.6 MiB	i3status
  1.0 MiB + 698.0 KiB =   1.7 MiB	dunst
  1.0 MiB + 832.0 KiB =   1.8 MiB	systemd
916.0 KiB +   1.0 MiB =   1.9 MiB	systemd-journald
  2.1 MiB + 755.5 KiB =   2.9 MiB	i3
  1.9 MiB +   1.5 MiB =   3.4 MiB	i3bar
  4.2 MiB + 681.0 KiB =   4.9 MiB	pulseaudio
  4.9 MiB + 103.5 KiB =   5.1 MiB	zsh
  5.6 MiB + 790.5 KiB =   6.4 MiB	polkitd
  6.6 MiB + 829.0 KiB =   7.4 MiB	urxvtd
 17.3 MiB + 755.0 KiB =  18.0 MiB	Xorg
 20.6 MiB +  69.5 KiB =  20.7 MiB	dnsmasq
131.0 MiB +   3.1 MiB = 134.1 MiB	dwb
---------------------------------
                        223.6 MiB
=================================

I guess if I closed dwb and stopped my dnsmasq adblocker, I would be significantly slower.  Without those, it would be 68.8 MiB.

Last edited by WonderWoofy (2013-03-06 05:06:09)

Offline

#13 2013-03-06 07:02:19

matteotom
Member
Registered: 2012-12-01
Posts: 7

Re: The memory usage statistics thread

Four systems to show:
Laptop, running arch:

 Private  +   Shared  =  RAM used       Program 

112.0 KiB +  15.0 KiB = 127.0 KiB       chrome-sandbox
120.0 KiB +  15.0 KiB = 135.0 KiB       tee
144.0 KiB +  20.5 KiB = 164.5 KiB       agetty
272.0 KiB +  30.5 KiB = 302.5 KiB       dbus-launch
328.0 KiB +  26.5 KiB = 354.5 KiB       lvmetad
364.0 KiB +  29.5 KiB = 393.5 KiB       fah6
364.0 KiB +  39.5 KiB = 403.5 KiB       dnsmasq
360.0 KiB +  83.5 KiB = 443.5 KiB       i3status
492.0 KiB +  63.5 KiB = 555.5 KiB       systemd-logind
596.0 KiB + 117.5 KiB = 713.5 KiB       sudo
872.0 KiB +  77.5 KiB = 949.5 KiB       bluetoothd
772.0 KiB + 206.5 KiB = 978.5 KiB       lxdm-binary
920.0 KiB +  62.5 KiB = 982.5 KiB       wpa_supplicant
892.0 KiB + 138.0 KiB =   1.0 MiB       ntpd
  1.0 MiB +  42.5 KiB =   1.0 MiB       htop
796.0 KiB + 384.5 KiB =   1.2 MiB       dbus-daemon (2)
944.0 KiB + 247.5 KiB =   1.2 MiB       sshd
  1.1 MiB +  54.0 KiB =   1.2 MiB       systemd-udevd
  1.1 MiB + 304.0 KiB =   1.4 MiB       avahi-daemon (2)
  1.1 MiB + 644.5 KiB =   1.7 MiB       bash (2)
  1.8 MiB + 295.0 KiB =   2.0 MiB       cjdns (2)
  1.5 MiB + 598.5 KiB =   2.0 MiB       i3bar
  1.7 MiB + 355.5 KiB =   2.1 MiB       nacl_helper_bootstrap
  1.9 MiB + 484.0 KiB =   2.3 MiB       conky
  2.4 MiB +  85.0 KiB =   2.5 MiB       systemd
  2.7 MiB + 217.0 KiB =   2.9 MiB       openvpn
  2.7 MiB + 633.5 KiB =   3.3 MiB       i3
  2.8 MiB + 607.5 KiB =   3.4 MiB       upowerd
  5.8 MiB + 489.5 KiB =   6.3 MiB       polkitd
  6.6 MiB + 817.0 KiB =   7.4 MiB       wicd-monitor
  7.4 MiB + 973.5 KiB =   8.4 MiB       CrPPAPIMain
 10.1 MiB + 541.0 KiB =  10.6 MiB       GoogleTalkPlugin
 11.2 MiB + 835.5 KiB =  12.0 MiB       wicd
 20.5 MiB +   1.4 MiB =  21.9 MiB       Xorg
 28.9 MiB +   2.0 MiB =  30.9 MiB       systemd-journald
 47.3 MiB +   1.8 MiB =  49.0 MiB       zsh (13)
 48.6 MiB +   2.2 MiB =  50.8 MiB       xterm (10)
 57.1 MiB +   1.5 MiB =  58.7 MiB       mosh-client (7)
 67.5 MiB +   1.2 MiB =  68.7 MiB       dropbox
 79.7 MiB +   2.1 MiB =  81.8 MiB       xchat
200.0 MiB + 402.5 KiB = 200.4 MiB       steam
173.8 MiB +  28.0 MiB = 201.8 MiB       chrome (7)
211.2 MiB +  15.0 KiB = 211.3 MiB       FahCore_a3.exe
859.5 MiB +  35.0 MiB = 894.5 MiB       CrRendererMain (25)
---------------------------------
                          1.9 GiB
=================================

Desktop, running arch:

 Private  +   Shared  =  RAM used       Program 

132.0 KiB +  42.0 KiB = 174.0 KiB       ifplugd
144.0 KiB +  48.5 KiB = 192.5 KiB       agetty
264.0 KiB + 105.5 KiB = 369.5 KiB       rtkit-daemon
336.0 KiB +  42.5 KiB = 378.5 KiB       lvmetad
496.0 KiB + 138.5 KiB = 634.5 KiB       systemd-logind
492.0 KiB + 241.5 KiB = 733.5 KiB       lxdm-binary
592.0 KiB + 158.5 KiB = 750.5 KiB       sudo
844.0 KiB +  83.0 KiB = 927.0 KiB       systemd-udevd
840.0 KiB +  98.0 KiB = 938.0 KiB       dbus-daemon
568.0 KiB + 388.0 KiB = 956.0 KiB       avahi-daemon [updated] (2)
856.0 KiB + 124.0 KiB = 980.0 KiB       fah6
892.0 KiB + 187.5 KiB =   1.1 MiB       ntpd
  2.3 MiB + 154.0 KiB =   2.4 MiB       systemd
  3.5 MiB + 115.0 KiB =   3.6 MiB       zsh
  1.4 MiB +   2.4 MiB =   3.8 MiB       sshd (3)
  7.1 MiB + 717.0 KiB =   7.8 MiB       polkitd
  8.5 MiB +   1.3 MiB =   9.8 MiB       lxdm-greeter-gtk
  9.4 MiB +   1.0 MiB =  10.5 MiB       systemd-journald
 42.1 MiB + 740.5 KiB =  42.9 MiB       Xorg
187.5 MiB +  15.0 KiB = 187.5 MiB       FahCore_a3.exe
---------------------------------
                        276.1 MiB
=================================

Server, also arch:

 Private  +   Shared  =  RAM used       Program 
  
108.0 KiB +  24.5 KiB = 132.5 KiB       rngd
112.0 KiB +  36.5 KiB = 148.5 KiB       agetty
176.0 KiB +  24.5 KiB = 200.5 KiB       dhcpcd [updated]
440.0 KiB + 156.5 KiB = 596.5 KiB       systemd-logind
636.0 KiB +  73.0 KiB = 709.0 KiB       systemd-udevd
720.0 KiB +  85.5 KiB = 805.5 KiB       sudo
852.0 KiB +  53.0 KiB = 905.0 KiB       dbus-daemon
776.0 KiB + 187.5 KiB = 963.5 KiB       ntpd
  1.1 MiB + 317.5 KiB =   1.4 MiB       sshd
  1.8 MiB +  84.0 KiB =   1.8 MiB       nano
  1.7 MiB + 324.5 KiB =   2.0 MiB       cjdns (2)
  2.2 MiB + 182.0 KiB =   2.4 MiB       systemd
  3.5 MiB + 427.5 KiB =   3.9 MiB       openvpn [updated]
  5.6 MiB + 922.5 KiB =   6.5 MiB       ircbot.py
  6.6 MiB + 580.5 KiB =   7.2 MiB       murmurd
  7.1 MiB +   1.4 MiB =   8.5 MiB       zsh (3)
  9.0 MiB + 704.0 KiB =   9.7 MiB       mosh-server (3)
  8.8 MiB +   1.0 MiB =   9.8 MiB       systemd-journald
 14.8 MiB +  10.6 MiB =  25.4 MiB       httpd (12)
 25.8 MiB + 380.0 KiB =  26.1 MiB       znc
---------------------------------
                        109.2 MiB
=================================

And gateway, running ClearOS:

 Private  +   Shared  =  RAM used       Program 

  4.0 KiB +  12.0 KiB =  16.0 KiB       openvt
  4.0 KiB +  23.0 KiB =  27.0 KiB       mysqld_safe
  4.0 KiB +  28.5 KiB =  32.5 KiB       hald-addon-acpi
  4.0 KiB +  33.0 KiB =  37.0 KiB       hald-addon-input
  4.0 KiB +  34.0 KiB =  38.0 KiB       hald-runner
 44.0 KiB +  20.5 KiB =  64.5 KiB       unlinkd
 20.0 KiB +  65.0 KiB =  85.0 KiB       mingetty (5)
 60.0 KiB +  29.5 KiB =  89.5 KiB       rpcbind
  4.0 KiB + 103.0 KiB = 107.0 KiB       login [updated]
 20.0 KiB + 131.5 KiB = 151.5 KiB       bash [updated] (5)
152.0 KiB +  26.5 KiB = 178.5 KiB       snortsam
128.0 KiB +  79.0 KiB = 207.0 KiB       master
216.0 KiB +  32.0 KiB = 248.0 KiB       ntpd
220.0 KiB +  34.0 KiB = 254.0 KiB       dbus-daemon
236.0 KiB +  18.0 KiB = 254.0 KiB       dhclient
228.0 KiB +  34.0 KiB = 262.0 KiB       auditd
224.0 KiB +  40.0 KiB = 264.0 KiB       init
196.0 KiB +  79.0 KiB = 275.0 KiB       qmgr
240.0 KiB +  40.0 KiB = 280.0 KiB       rpc.mountd [updated]
272.0 KiB +  62.5 KiB = 334.5 KiB       proftpd
196.0 KiB + 180.0 KiB = 376.0 KiB       console-kit-daemon
392.0 KiB +  31.0 KiB = 423.0 KiB       crond
324.0 KiB + 109.0 KiB = 433.0 KiB       udevd (3)
464.0 KiB +  24.0 KiB = 488.0 KiB       dnsmasq
532.0 KiB + 116.5 KiB = 648.5 KiB       hald
556.0 KiB + 100.5 KiB = 656.5 KiB       clearsyncd
668.0 KiB +  97.5 KiB = 765.5 KiB       mpdscribble
760.0 KiB + 103.0 KiB = 863.0 KiB       tconsole
828.0 KiB +  77.0 KiB = 905.0 KiB       nscd
824.0 KiB + 113.5 KiB = 937.5 KiB       snmpd
800.0 KiB + 315.0 KiB =   1.1 MiB       pickup
  1.0 MiB +  90.0 KiB =   1.1 MiB       nslcd
840.0 KiB + 280.0 KiB =   1.1 MiB       sudo
  1.3 MiB +  36.0 KiB =   1.3 MiB       rsyslogd
  1.5 MiB + 163.0 KiB =   1.6 MiB       icecast
984.0 KiB + 762.0 KiB =   1.7 MiB       bash (4)
  1.7 MiB +  60.5 KiB =   1.7 MiB       zsh
  2.1 MiB +  45.0 KiB =   2.2 MiB       syswatch
  1.0 MiB +   1.6 MiB =   2.6 MiB       sshd (3)
  2.3 MiB + 534.0 KiB =   2.8 MiB       tmux (8)
  2.9 MiB +  96.5 KiB =   3.0 MiB       slapd
844.0 KiB +   6.0 MiB =   6.8 MiB       webconfig (4)
  7.8 MiB + 315.5 KiB =   8.1 MiB       mpd
  7.1 MiB +   1.7 MiB =   8.7 MiB       dansguardian-av (35)
  3.0 MiB +   6.9 MiB =   9.8 MiB       httpd (12)
 13.1 MiB +  94.0 KiB =  13.1 MiB       system-mysqld
 51.6 MiB +   1.7 MiB =  53.3 MiB       rtorrent (4)
 62.2 MiB + 764.0 KiB =  63.0 MiB       mosh-server (4)
 98.2 MiB +  57.5 KiB =  98.3 MiB       snort
126.8 MiB + 200.0 KiB = 127.0 MiB       squid (2)
---------------------------------
                        417.8 MiB
=================================

Offline

#14 2013-03-06 07:18:30

andmars
Member
Registered: 2012-03-13
Posts: 362

Re: The memory usage statistics thread

x33a wrote:

Yeah that's why many people are switching over to st.

yes, even though st is not really usable at this point (at least for me). It has some issues in combination with feh and fullscreen, or using "del"-button, and it lacks some nice functionallity like scrolling or clickable urls. I also don't see the point in writing a stripped down version of urxvt without these functions and then having to add another tool like screen or tmux to get them back.

UPDATE:
and to prove my point I just build urxvt from ABS and disabled all the functionality that I don't need, like: unicode3, xft, xim, xterm-scroll, fading, transparency. All that's bloating up urxvt now is that it saves lines.

before;

7.1 MiB + 426.0 KiB =   7.5 MiB       urxvt

after;

6.3 MiB + 366.5 KiB =   6.6 MiB       urxvt

st and tmux;

1.0 MiB + 337.5 KiB =   1.3 MiB       tmux (2)
3.1 MiB + 321.0 KiB =   3.4 MiB       st

but are we really arguing about 2-3MiB when most of us have at least 4GiB of RAM build in their machines?



WonderWoofy wrote:

I guess if I closed dwb and stopped my dnsmasq adblocker, I would be significantly slower.  Without those, it would be 68.8 MiB.

In what way is dnsmasq for adblocking better than using privoxy (which I use)?

1.4 MiB + 124.5 KiB =   1.5 MiB         privoxy
51.1 MiB +   1.6 MiB =  52.7 MiB	dwb

Last edited by andmars (2013-03-06 08:54:54)

Offline

#15 2013-03-06 17:58:46

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The memory usage statistics thread

andmars wrote:
x33a wrote:

Yeah that's why many people are switching over to st.

yes, even though st is not really usable at this point (at least for me). It has some issues in combination with feh and fullscreen, or using "del"-button, and it lacks some nice functionallity like scrolling or clickable urls. I also don't see the point in writing a stripped down version of urxvt without these functions and then having to add another tool like screen or tmux to get them back.

Yeah, that's why I haven't switched over to it yet.

My latest results, same machine as earlier with 1 GB of RAM tongue

 Private  +   Shared  =  RAM used	Program 

 52.0 KiB +  19.5 KiB =  71.5 KiB	init-openrc
  4.0 KiB +  68.0 KiB =  72.0 KiB	sshd
 16.0 KiB +  85.0 KiB = 101.0 KiB	login
 16.0 KiB +  88.0 KiB = 104.0 KiB	agetty (4)
 72.0 KiB +  33.5 KiB = 105.5 KiB	xinit
 76.0 KiB +  40.0 KiB = 116.0 KiB	systemd-udevd
108.0 KiB +  21.5 KiB = 129.5 KiB	gnome-pty-helper
112.0 KiB +  20.5 KiB = 132.5 KiB	crond
128.0 KiB +  16.0 KiB = 144.0 KiB	tail
180.0 KiB +  34.5 KiB = 214.5 KiB	xsel
216.0 KiB +  48.0 KiB = 264.0 KiB	su
216.0 KiB +  51.0 KiB = 267.0 KiB	unclutter
244.0 KiB +  29.0 KiB = 273.0 KiB	dbus-launch
268.0 KiB +  35.0 KiB = 303.0 KiB	sh
556.0 KiB +  53.5 KiB = 609.5 KiB	sudo
424.0 KiB + 342.0 KiB = 766.0 KiB	syslog-ng (2)
656.0 KiB + 263.0 KiB = 919.0 KiB	autocutsel (2)
548.0 KiB + 397.0 KiB = 945.0 KiB	dbus-daemon (3)
668.0 KiB + 337.5 KiB =   1.0 MiB	at-spi2-registryd
960.0 KiB +  55.0 KiB =   1.0 MiB	xbindkeys
684.0 KiB + 371.0 KiB =   1.0 MiB	at-spi-bus-launcher
932.0 KiB + 160.5 KiB =   1.1 MiB	ssh
  1.0 MiB + 269.0 KiB =   1.3 MiB	conky
  1.6 MiB + 149.5 KiB =   1.7 MiB	mutt
  2.0 MiB + 247.0 KiB =   2.2 MiB	mc
  2.3 MiB + 337.5 KiB =   2.6 MiB	tmux (3)
  3.3 MiB +  62.0 KiB =   3.4 MiB	prosody
  3.6 MiB +  91.5 KiB =   3.7 MiB	iftop
  4.2 MiB +   1.2 MiB =   5.4 MiB	urxvt
  7.4 MiB +   1.1 MiB =   8.5 MiB	urxvtd
 15.4 MiB +   1.2 MiB =  16.7 MiB	bash (15)
 17.0 MiB + 517.0 KiB =  17.6 MiB	cmus
 22.1 MiB +   1.3 MiB =  23.5 MiB	i3bar
 22.4 MiB +   1.4 MiB =  23.8 MiB	i3
 27.5 MiB +   1.9 MiB =  29.4 MiB	sakura
 31.9 MiB +   3.4 MiB =  35.3 MiB	pidgin
 36.9 MiB +   1.5 MiB =  38.3 MiB	Xorg
353.4 MiB +   5.7 MiB = 359.1 MiB	firefox (2)
---------------------------------
                        582.0 MiB
=================================

@ WonderWoofy and @ matteotom

My i3{,bar} memory usage is almost ten times than yours!

Offline

#16 2013-03-06 20:05:34

unclemike
Member
From: it_IT
Registered: 2011-06-01
Posts: 12

Re: The memory usage statistics thread

 Private  +   Shared  =  RAM used       Program 

 88.0 KiB +   9.0 KiB =  97.0 KiB       start_kdeinit
104.0 KiB +  16.5 KiB = 120.5 KiB       kwrapper4
152.0 KiB +  27.0 KiB = 179.0 KiB       agetty
264.0 KiB +  47.5 KiB = 311.5 KiB       rtkit-daemon
296.0 KiB +  34.5 KiB = 330.5 KiB       dbus-launch
332.0 KiB +  30.0 KiB = 362.0 KiB       gpg-agent
380.0 KiB +  17.5 KiB = 397.5 KiB       ssh-agent
476.0 KiB +  60.5 KiB = 536.5 KiB       systemd-logind
292.0 KiB + 362.0 KiB = 654.0 KiB       startkde
624.0 KiB +  30.5 KiB = 654.5 KiB       ksysguardd
596.0 KiB + 118.0 KiB = 714.0 KiB       sudo
668.0 KiB + 364.0 KiB =   1.0 MiB       bash
732.0 KiB + 410.0 KiB =   1.1 MiB       kdm (2)
  1.0 MiB + 142.5 KiB =   1.2 MiB       ntpd
  1.1 MiB + 331.0 KiB =   1.4 MiB       pppd
  1.5 MiB +  57.5 KiB =   1.5 MiB       systemd-udevd
  1.5 MiB + 259.5 KiB =   1.8 MiB       modem-manager
  1.6 MiB + 334.5 KiB =   1.9 MiB       upowerd
  1.1 MiB + 986.5 KiB =   2.0 MiB       klauncher
  1.7 MiB + 381.5 KiB =   2.1 MiB       dbus-daemon (2)
  2.0 MiB + 281.0 KiB =   2.2 MiB       udisksd
  2.2 MiB +  89.0 KiB =   2.2 MiB       systemd
  1.9 MiB + 333.0 KiB =   2.3 MiB       akonadi_control
  1.9 MiB + 396.0 KiB =   2.3 MiB       colord
  2.2 MiB + 414.0 KiB =   2.6 MiB       cupsd
  2.9 MiB + 543.0 KiB =   3.4 MiB       NetworkManager
  2.7 MiB +   1.3 MiB =   4.1 MiB       klipper
  3.0 MiB +   1.3 MiB =   4.3 MiB       ksmserver
  4.4 MiB + 388.5 KiB =   4.7 MiB       pulseaudio
  3.8 MiB +   1.2 MiB =   5.0 MiB       kglobalaccel
  4.5 MiB + 920.0 KiB =   5.4 MiB       kuiserver
  4.7 MiB +   1.1 MiB =   5.8 MiB       polkit-kde-authentication-agent-1
776.0 KiB +   5.1 MiB =   5.9 MiB       kdeinit4
  5.8 MiB +   1.0 MiB =   6.9 MiB       knotify4
  5.3 MiB +   1.7 MiB =   7.0 MiB       akonadi_maildispatcher_agent
  6.9 MiB + 340.5 KiB =   7.3 MiB       systemd-journald
  6.6 MiB + 648.5 KiB =   7.3 MiB       akonadiserver
  7.0 MiB + 345.0 KiB =   7.3 MiB       polkitd
  5.3 MiB +   2.3 MiB =   7.6 MiB       kmix
  5.9 MiB +   1.9 MiB =   7.8 MiB       akonadi_nepomuk_feeder
  5.3 MiB +   2.7 MiB =   7.9 MiB       konsole
  8.3 MiB +   1.1 MiB =   9.4 MiB       kactivitymanagerd
 11.9 MiB +   3.4 MiB =  15.3 MiB       kded4
 13.2 MiB +   3.2 MiB =  16.4 MiB       krunner
 10.9 MiB +   5.7 MiB =  16.7 MiB       kwin
 17.2 MiB +   6.0 MiB =  23.2 MiB       akonadi_agent_launcher (4)
 27.3 MiB +   4.4 MiB =  31.8 MiB       Xorg
 68.8 MiB +   7.8 MiB =  76.5 MiB       plasma-desktop
125.3 MiB +   4.7 MiB = 130.0 MiB       thunderbird
154.1 MiB +   4.8 MiB = 158.9 MiB       firefox
---------------------------------
                        605.7 MiB
=================================

Offline

#17 2013-03-11 22:34:35

archnet
Member
Registered: 2011-05-09
Posts: 42

Re: The memory usage statistics thread

It's a nice script. But, can I trust it? The values don't mesh with what many other tools tell me - it indicates much less than what other tools report.

For example, I ran it without X. It indicated I was using about 18 MiB. That would be awesome if it were true...but, my other tools showed I was using about 88 MiB. I like the prior's number but think the later is more accurate. When I ran the tests again in X, the differences were about 80 MiB for the script and about 161MiB for the other tools.

The other tools I used, which were all within a couple megabytes of agreement were top, free, htop, and conky.



As an aside, has anyone else noticed how much more memory the new systemd uses relative to init and friends.

Offline

#18 2013-03-12 05:34:16

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: The memory usage statistics thread

Sorry for the OT thread, but andmars doesn't appear to have an email address linked to his forum account, forcing me to respond here.

andmars wrote:

In what way is dnsmasq for adblocking better than using privoxy (which I use)?

I am having a hard time finding where I say "My ad blocking solution is so much better than privoxy!"

So I don't really know that it is better.  To be honest I don't really know that much about privoxy.  I tried it for a minute long ago, but quickly found it to be more trouble than it was worth.  So I will tell you what I do and you can decide for yourself if you think this is better or not.

I use a kind of hosts file for my ad blocking.  Typically this is done with /etc/hosts for system wide blocking.  But I instead use /etc/hosts.deny, as this happens to be the default for hosts_update which is a script that can be updated in the AUR.  So I run that periodically to update my lists of blocked sites.  It gathers several different lists and then seems to do a "sort -u" on it.  What is nice is that if I find a url that I don't want to deny there is a whitelist file so those are removed from your deny list (I was doing this manually before I found this tool, as I never found it enough of a burden to actually script it out... though that also meant I hardly updated the list).

So then I use dnsmasq as a DNS caching daemon that loads that list when it starts.  This also brings the benefits you will inherently experience with a DNS caching daemon.

I use dnsmasq as the first nameserver so that it is the first to feed back this information.  You can set 127.0.0.1 to be the first nameserver by using /etc/resolv.conf.head if you are using dhpcpcd.  So the resolution of these DNS queries (or any that are subsequently cached by dnsmasq) are fed back in 0ms, according to the dig tool.

The bad ad laden urls are fed back to localhost for which I have kwakd running so that it can be served a (nearly) blank page.  I started with pixelserv, but found out shortly thereafter that it is a seemingly dead project, which kwakd seems active.

So instead of feeding all network traffic through a proxy and have it do... I'm not exactly sure... it just never resolves those IP addresses from an actual authoritative DNS server and is then fed nothing (actually I think that kwakd serves up a single transparent pixel a la pixelserv, but I am not 100% on that).

So the list of blocked ads is in RAM, and I see no noticeable slowdown from this set up tools (which I have assembled with scotch tape and elmers glue). 

Is it better?  I like it better, and my dog thinks its better (he agrees with me typically, as I am the controller of dog jerky).  Do you or anyone else think this way is better?  I have no idea... you tell me.

Offline

#19 2013-03-12 11:45:22

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: The memory usage statistics thread

archnet wrote:

It's a nice script. But, can I trust it? The values don't mesh with what many other tools tell me - it indicates much less than what other tools report.

For example, I ran it without X. It indicated I was using about 18 MiB. That would be awesome if it were true...but, my other tools showed I was using about 88 MiB. I like the prior's number but think the later is more accurate. When I ran the tests again in X, the differences were about 80 MiB for the script and about 161MiB for the other tools.

The other tools I used, which were all within a couple megabytes of agreement were top, free, htop, and conky.

Agreed, but looking at the total usage for the system, the values of this script compared to free and htop seem to be almost the same. I wonder where the difference lies.

As an aside, has anyone else noticed how much more memory the new systemd uses relative to init and friends.

You can look at my latest result and see that  init (with openrc) + syslog-ng consumes less memory as compared to systemd + tools, but in absolute terms systemd isn't too heavy.

Offline

#20 2013-03-12 14:56:30

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: The memory usage statistics thread

archnet wrote:

It's a nice script. But, can I trust it? The values don't mesh with what many other tools tell me - it indicates much less than what other tools report.

I think it just has to do with how it calculates the memory:

# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.

In (h)top if you subtract the shared memory from the resident memory you get an (under) approximation for what the script gives you. As x33a noticed, both tools are fairly close in total memory usage:

x33a wrote:

Agreed, but looking at the total usage for the system, the values of this script compared to free and htop seem to be almost the same.

Offline

#21 2013-03-12 15:07:00

kaszak696
Member
Registered: 2009-05-26
Posts: 543

Re: The memory usage statistics thread

 Private  +   Shared  =  RAM used	Program 

100.0 KiB +  18.5 KiB = 118.5 KiB	wpa_actiond
104.0 KiB +  22.0 KiB = 126.0 KiB	chromium-sandbox
148.0 KiB +  30.5 KiB = 178.5 KiB	agetty
188.0 KiB +  20.5 KiB = 208.5 KiB	dhcpcd [updated]
188.0 KiB +  44.0 KiB = 232.0 KiB	acpid
232.0 KiB +  41.5 KiB = 273.5 KiB	dbus-launch
244.0 KiB +  30.0 KiB = 274.0 KiB	xsel
316.0 KiB +  77.0 KiB = 393.0 KiB	unclutter
456.0 KiB +  92.5 KiB = 548.5 KiB	systemd-logind
600.0 KiB +  38.5 KiB = 638.5 KiB	crond
620.0 KiB +  48.5 KiB = 668.5 KiB	hddtemp
616.0 KiB + 144.0 KiB = 760.0 KiB	sudo
772.0 KiB + 318.0 KiB =   1.1 MiB	dunst
884.0 KiB + 235.0 KiB =   1.1 MiB	ntpd
  1.0 MiB +  95.5 KiB =   1.1 MiB	wpa_supplicant
828.0 KiB + 460.5 KiB =   1.3 MiB	dbus-daemon (3)
916.0 KiB + 409.0 KiB =   1.3 MiB	at-spi2-registryd
  1.3 MiB +  70.5 KiB =   1.4 MiB	systemd-udevd
  1.7 MiB + 266.5 KiB =   2.0 MiB	cupsd
932.0 KiB +   1.1 MiB =   2.1 MiB	systemd-journald
  2.1 MiB + 109.0 KiB =   2.2 MiB	systemd
  1.6 MiB + 718.5 KiB =   2.3 MiB	i3bar
  1.8 MiB + 495.0 KiB =   2.3 MiB	nacl_helper_bootstrap
  2.0 MiB + 724.0 KiB =   2.7 MiB	colord
  2.4 MiB + 413.0 KiB =   2.8 MiB	i3
  2.9 MiB + 375.5 KiB =   3.2 MiB	at-spi-bus-launcher
  3.6 MiB +  81.5 KiB =   3.7 MiB	zsh
  8.5 MiB + 655.5 KiB =   9.1 MiB	slim
  9.8 MiB + 339.0 KiB =  10.1 MiB	mpd
 12.5 MiB +   1.4 MiB =  13.9 MiB	spacefm
 13.8 MiB + 254.0 KiB =  14.1 MiB	python3.3
 14.0 MiB + 312.0 KiB =  14.3 MiB	urxvt
 36.8 MiB + 816.5 KiB =  37.6 MiB	Xorg
120.1 MiB +  21.6 MiB = 141.7 MiB	chromium (5)
186.0 MiB +  25.7 MiB = 211.7 MiB	CrRendererMain (9)
---------------------------------
                        487.5 MiB
=================================

Chromium is such a glutton.


'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard

Offline

#22 2013-03-12 15:12:39

nagaseiori
Member
Registered: 2012-09-22
Posts: 72

Re: The memory usage statistics thread

I try to use the most out of my machine (8 GB RAM)

 Private  +   Shared  =  RAM used       Program 

 96.0 KiB +  11.0 KiB = 107.0 KiB       chromium-sandbox
192.0 KiB +  18.5 KiB = 210.5 KiB       xinit
208.0 KiB +  25.5 KiB = 233.5 KiB       dhcpcd
176.0 KiB +  94.0 KiB = 270.0 KiB       sleep (2)
256.0 KiB +  20.5 KiB = 276.5 KiB       dbus-launch
260.0 KiB + 133.5 KiB = 393.5 KiB       su
408.0 KiB +  16.0 KiB = 424.0 KiB       urxvt-launcher.
436.0 KiB +  16.0 KiB = 452.0 KiB       startx
440.0 KiB +  50.5 KiB = 490.5 KiB       xcompmgr
468.0 KiB +  72.5 KiB = 540.5 KiB       systemd-logind
452.0 KiB +  93.5 KiB = 545.5 KiB       dwm-statusbar.s
552.0 KiB +  41.5 KiB = 593.5 KiB       sshd
476.0 KiB + 132.0 KiB = 608.0 KiB       wallpaper.sh
600.0 KiB +  31.0 KiB = 631.0 KiB       eclipse (2)
576.0 KiB + 100.0 KiB = 676.0 KiB       gconfd-2
596.0 KiB +  83.5 KiB = 679.5 KiB       dwm
596.0 KiB + 141.5 KiB = 737.5 KiB       sudo
984.0 KiB +  43.0 KiB =   1.0 MiB       systemd-udevd
696.0 KiB + 332.5 KiB =   1.0 MiB       dbus-daemon (2)
980.0 KiB +  67.5 KiB =   1.0 MiB       cupsd
  1.0 MiB +  23.5 KiB =   1.0 MiB       mount.ntfs
  1.1 MiB +  92.5 KiB =   1.2 MiB       wpa_supplicant
  1.1 MiB + 229.5 KiB =   1.3 MiB       bash
  1.3 MiB +  58.5 KiB =   1.4 MiB       tmux (2)
  1.2 MiB + 282.0 KiB =   1.4 MiB       login (2)
  1.5 MiB + 179.0 KiB =   1.6 MiB       nacl_helper_bootstrap
  1.6 MiB +  93.5 KiB =   1.7 MiB       colord
  2.0 MiB + 258.0 KiB =   2.3 MiB       VBoxXPCOMIPCD
  2.2 MiB + 434.0 KiB =   2.6 MiB       systemd (2)
  3.0 MiB +   1.1 MiB =   4.1 MiB       systemd-journald
  5.9 MiB +   1.0 MiB =   6.9 MiB       VBoxSVC
  9.2 MiB + 151.0 KiB =   9.4 MiB       urxvt
 10.4 MiB + 264.5 KiB =  10.6 MiB       rtorrent
 10.8 MiB + 239.5 KiB =  11.0 MiB       mpd
 15.6 MiB +   1.3 MiB =  16.9 MiB       zsh (6)
 37.5 MiB +   7.4 MiB =  44.9 MiB       Xorg
280.6 MiB +  34.4 MiB = 315.0 MiB       chromium (6)
541.5 MiB +   6.2 MiB = 547.7 MiB       java (2)
630.6 MiB +  48.9 MiB = 679.4 MiB       CrRendererMain (20)
  2.8 GiB +  26.0 MiB =   2.8 GiB       VirtualBox (2)
---------------------------------
                          4.5 GiB
=================================

Offline

#23 2013-03-13 02:16:19

archnet
Member
Registered: 2011-05-09
Posts: 42

Re: The memory usage statistics thread

x33a wrote:

Agreed, but looking at the total usage for the system, the values of this script compared to free and htop seem to be almost the same. I wonder where the difference lies.

anonymous_user wrote:

I think it just has to do with how it calculates the memory:

# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.

In (h)top if you subtract the shared memory from the resident memory you get an (under) approximation for what the script gives you. As x33a noticed, both tools are fairly close in total memory usage:

I'll give an example. I had a _single_ instance of mksh running (so the whole per program vs per process is moot). Top tells me that mksh is using 6416 VIRT, 940 RES, and 780 SHR. That works out to 160 Private + 780 Shared = 940 Total. That is what I would expect this script to tell me in this case as well. But, the output tells me that it is using 492.0 Private + 34.5 Shared = 526.5 Total. The output of the two don't align in any way that I can sense. And the prima facia authority rests with top, free, ps, etc. over this script in my opinion. I guess the next step is to look at the code and try to see what it is trying to do.

Offline

Board footer

Powered by FluxBB