who occupies the swap ?

Robert Heller heller at deepsoft.com
Thu Dec 2 03:10:35 UTC 2021


At Wed, 1 Dec 2021 18:09:00 +0100 (CET) "Ubuntu user technical support,? not for general discussions" <ubuntu-users at lists.ubuntu.com> wrote:

> 
> Hi,
> 
> we have one host with 20.04 which sometimes ran out of swap space.
> Is there a way to find out who occupies the swap ? In atop the logs show the swapsize for each process, but the sum of all swapsizes
> is much smaller than the complete used swap.
> And what happens if processes end ? Is the respective swap space cleaned up ?

It really is meaningless to figure out what is in swap space.  Every process 
uses virtual memory, which is the combination of RAM and swap space.  When RAM 
is used up, the kernel moves unused (or little used) memory to the swap space 
and moves it back when needed.

When the system runs out of virtual memory a kernel process call OOM (Out Of 
Memory), which kills off processes to free up memory, since when a process 
ends (terminates or is killed), the virtual memory it uses is reclaimed and 
becomes available for other processes.

Running out of virtual memory usually means you have a memory leak or you have 
just overloaded the system.  Either the system needs more memory (RAM or swap) 
or you need to reduce the number of processes or otherwise reduce the load. Or 
maybe you need to fix the memory leak, if that is the problem.



> 
> Thanks.
> 
> Bernd
> 

-- 
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller at deepsoft.com       -- Webhosting Services
                                                                                                                               




More information about the ubuntu-users mailing list