You are not logged in.

#1 2013-03-14 00:02:06

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

Where is all my RAM going?

A recent thread (https://bbs.archlinux.org/viewtopic.php?id=118050) got me curious. So, I booted into a basic console session with bare minimums. Here is the result of top showing the memory statistics of only those processes that top showed had a non-zero memory usage (I sorted by memory). The values are 1) VIRT, 2) RES, and 3) SHR.


3978032 total, 151816 used, 3826216 free, 10468 buffers, 54048 cached

systemd-journal  306m  12m  12m
systemd         32532 3112 1880
nvi             17672 3096 2056
systemd-udevd   31632 2024 1088
login           63012 1916 1472
login           63012 1916 1472
systemd-logind  26088 1608 1308
top             13388 1440 1040
wpa_supplicant  32316 1356  804
dbus-daemon     19368 1304 1076
agetty           8148  820  700
agetty           8148  820  700
dash             4312  716  588
dash             4312  716  588
wpa_actiond      4216  480  392
dhcpcd           8568  344  200

Immediately following logging this information, I ran free, which gave me this information.

             total       used       free     shared    buffers     cached
Mem:       3978032     150436    3827596          0      10508      54052
-/+ buffers/cache:      85876    3892156
Swap:            0          0          0

That's almost 84 megabytes for doing just about nothing!!! One thing that really stands out is how much of a resource hog systemd is. Why did Arch move away from the lean & mean init machine?!

Now, if you just naively add up all the RES values, they only add up to 33956K. That's only 33 megabytes. So somewhere there's 50 megabytes being eaten by something that isn't being reported.

Anyone know where my missing 50 megabytes may be found?

Offline

#2 2013-03-14 00:24:07

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 19,077
Website

Re: Where is all my RAM going?

archnet wrote:

One thing that really stands out is how much of a resource hog systemd is. Why did Arch move away from the lean & mean init machine?!

https://bbs.archlinux.org/viewtopic.php … 0#p1149530


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#3 2013-03-14 00:27:52

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

Re: Where is all my RAM going?

jasonwryan wrote:
archnet wrote:

One thing that really stands out is how much of a resource hog systemd is. Why did Arch move away from the lean & mean init machine?!

https://bbs.archlinux.org/viewtopic.php … 0#p1149530

Yeah, I've read the developers reasons. I still don't buy into them, though. But, that's neither here nor there for the purpose of basic question I pose here, though. My mention of it was more-or-less of an ugh! moment. If I want to delve further into that discussion, I'll start another thread devoted to it.

Offline

#4 2013-03-14 00:32:39

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 19,077
Website

Re: Where is all my RAM going?

archnet wrote:
jasonwryan wrote:
archnet wrote:

One thing that really stands out is how much of a resource hog systemd is. Why did Arch move away from the lean & mean init machine?!

https://bbs.archlinux.org/viewtopic.php … 0#p1149530

Yeah, I've read the developers reasons. I still don't buy into them, though. But, that's neither here nor there for the purpose of basic question I pose here, though. My mention of it was more-or-less of an ugh! moment. If I want to delve further into that discussion, I'll start another thread devoted to it.

Don't do that: this "question" has been asked many times, and the answer is provided in the post I linked to.

Forum Etiquette wrote:

Furthermore, questioning or discussing the methods used by the Arch Linux development team will be monitored closely and locked if deemed unhelpful and/or unproductive. Harsh, unproductive criticism is also uncalled for.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#5 2013-03-14 01:00:52

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Where is all my RAM going?

systemd doesn't eat much RAM here.

  PID User     Command                         Swap      USS      PSS      RSS
  137 root     /usr/lib/systemd/systemd-ud   428.0K     4.0K     9.0K   284.0K 
  334 root     /usr/lib/systemd/systemd-lo   208.0K    76.0K    87.0K   560.0K 
  138 root     /usr/lib/systemd/systemd-jo   224.0K    96.0K   104.0K   444.0K 
    1 root     /bin/systemd                  772.0K   540.0K   554.0K     1.0M

syslog, consolekit, udev and regular init (all replaced by systemd) were also using memory.

4311 root     /usr/sbin/console-kit-daemo        0     1.2M     1.6M     3.4M 
4714 root     /usr/sbin/syslog-ng -F             0     1.5M     1.8M     3.2M

Last edited by lucke (2013-03-14 01:10:32)

Offline

#6 2013-03-14 07:29:03

Awebb
Member
Registered: 2010-05-06
Posts: 4,440

Re: Where is all my RAM going?

Those 50MB are found in your lack of comprehension of RAM handling in Linux. I will demonstrate.

After Killing KDM:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          2010        925       1085          0         75        742
-/+ buffers/cache:        107       1902
Swap:         2047          0       2047

After stopping everything in multi.user.target:

# systemctl stop avahi-daemon.socket cronie.service cups.socket ftpd.service mpd.service NetworkManager.service sshd.service syslog-ng.service
$ free -m
             total       used       free     shared    buffers     cached
Mem:          2010        906       1104          0         75        743
-/+ buffers/cache:         87       1923
Swap:         2047          0       2047

After disabling everything in multi.user.target and rebooting:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          2010         76       1934          0         15         25
-/+ buffers/cache:         34       1975
Swap:         2047          0       2047

Similar phenomena can be observed even without systemd. This is neither pleasant nor particularly useful, but it is the way of the penguin. The only way to really know, how much free ram you have, is redirecting /dev/urandom to both, a file in /tmp as well as /dev/shm, wait for them to terminate and add the sizes. Whatever you do, don't be that kind of a dick and warm over last years trollbait, just because you don't understand the system.

Offline

#7 2013-03-14 07:58:44

elkoraco
Member
Registered: 2013-02-18
Posts: 121

Re: Where is all my RAM going?

archnet wrote:

That's almost 84 megabytes for doing just about nothing!!!

How dare they? A whole 84 MB!

Offline

#8 2013-03-14 08:28:19

Awebb
Member
Registered: 2010-05-06
Posts: 4,440

Re: Where is all my RAM going?

elkoraco wrote:
archnet wrote:

That's almost 84 megabytes for doing just about nothing!!!

How dare they? A whole 84 MB!

Eh, that's what Crunchbang used to eat in a full desktop :-D

Offline

Board footer

Powered by FluxBB