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

Re: swap maxed out when plenty of RAM available



On Tue, Mar 22, 2022 at 01:00:42PM -0500, Nicholas Geovanis wrote:
> That's the usual issue. The /tmp filesystem is usually configured to live
> in RAM,

That's not the default in Debian.  Of course, it might have been set up
that way on the OP's system.

> at some point an application needed to use lots of it. It may not have
> freed it properly
> from dying or maybe it's still running, or just misbehaving :-)

When an application terminates, all of the memory that it used for
private variables and such gets freed, and becomes available to other
processes.  However, this doesn't cause swapped-out pages belonging
to other processes to be swapped back in.  So, for example, immediately
after closing a web browser that was using gobs and gobs of memory, you
might see that the "used" memory drops dramatically, and "free" memory
grows.  But the amount of swap being used won't change immediately.

Swap space is used primarily (or ideally) by *inactive* processes.  It
won't be released until one of those processes wakes up and needs the
data that has been swapped out.  Or until one of those inactive
processes terminates, at which point all of its swap usage is released.

(When swap is used by an *active* process, that's called thrashing.  At
that point, you're in trouble.)


Reply to: