Rich Freeman via plug on 20 May 2020 10:34:33 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] memory usage in Linux


On Tue, May 19, 2020 at 2:35 PM Eric Lucas via plug
<plug@lists.phillylinux.org> wrote:
>
> I'm running Kubuntu 18.04 [1] on a Dell Laptop with a 2-core i7 [2] and 16 GB of RAM (the max apparently.)
> I tend to leave lots of windows open on two or three of my four virtual desktops.
> Sometimes things get slow (like participating in a zoom chat with a few dozen fellow homebrewers last night.)
> I installed 'cockpit' to see what's up. All is okay except for RAM. It shows near 16GB of RAM used.
> I seem to recall (from years ago) that Linux "hoovers up" all the RAM and then parcels it out to applications as needed.
> If so, what's the point of telling me how much RAM I have used if it's always 99+%?
> How do others monitor and/or manage RAM usage in Linux?
>

Here is a typical output of the "free" command:
free
              total        used        free      shared  buff/cache   available
Mem:       16373372     8077212     2613968     2766012     5682192     5184788
Swap:             0           0           0

Total is just the amount of RAM in the system - 16GB in this case
(same as with you).

Used is total - free - buffers - cache.
Available is what is available for use, taking into account reclaiming
buffers and cache.  It isn't the same as total - used because not all
of this memory can be reclaimed.  This is what I would probably focus
on when monitoring.
Free is memory that is completely unused.  As you say the kernel tries
to minimize this, but if a big process dies there will be free ram
until it gets filled with cache/etc, which won't happen until there is
IO.

I would just focus on available memory from a memory management standpoint.

I'm sure there are GUI applications that can monitor this as well.
MemAvailable also shows up in /proc/meminfo.

Monitoring swap use is also important, but you really want to see how
much is swapping in and out - a slow memory leak might lead to a bunch
of swap getting used and isn't ideal, but probably won't impact actual
performance.

-- 
Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug