Usually the swap section is empty and is filled only when working with very large graphic files. But the second day is going some disarray. You can solve the problem by logging out and re-logging in to your account, but I am interested to know what exactly the swap scores. How to find out?

In addition to browsers, NetBeans, audio, video and virtual machines did not run anything. I didn’t do anything special - as usual.

Previously, I did not log out for two weeks and everything was fine.

Htop screen shot

  • Wow, I did not know how to insert a picture. Now, too, there will be a question from me with a picture. - root_x Povierennyy
  • Tell me how to upload a picture to SO. Or is it only moderators \ editors? - root_x Povierennyy

3 answers 3

Found somewhere in the open and slightly dopilo under its own environment. You may have to finish it too, the main thing is to understand the principle:

#!/bin/sh for dir in $(find /proc/ -maxdepth 1 -type d |grep -E "[0-9]+"); do pid=$(echo $dir |cut -d/ -f3) cmd=$(ps h -o comm -p $pid) swap=$(grep VmSwap $dir/status 2> /dev/null |awk '{print $2}') if [ ! -z $swap ] && [ $swap -ne 0 ]; then echo "pid: $pid command: $cmd swap: $swap KB" fi done | sort -rnk6 | column -t 
  • I wrote below (above) what happened and why. - root_x Povierennyy
  • "the main thing is to understand the principle:" - that is yes, but before in-depth study somehow the hands do not reach. % :) - root_x Povierennyy

You can run top and press f - a list of parameters that it (top) can display is displayed. Choose the SWAP display - and you will see what processes how much data is held there. And you can sort by this column by pressing F.

    Another option:

     #!/bin/bash # Get current swap usage for all running processes # Erik Ljungstrom 27/05/2011 SUM=0 OVERALL=0 for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do PID=`echo $DIR | cut -d / -f 3` PROGNAME=`ps -p $PID -o comm --no-headers` for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'` do let SUM=$SUM+$SWAP done echo "PID=$PID - Swap used: $SUM - ($PROGNAME )" let OVERALL=$OVERALL+$SUM SUM=0 done echo "Overall swap used: $OVERALL" 

    Found here http://northernmost.org/blog/find-out-what-is-using-your-swap/


    I want to answer where did the problem with swap-space come from. This could be this bug http://osdir.com/ml/ubuntu-bugs/2016-03/msg00360.html , but I have version 14.04, so this is not my case.

    On my system so

     xuser@mh:~$ df -h Файл.система Размер Использовано Дост Использовано% Cмонтировано в udev 3,9G 4,0K 3,9G 1% /dev tmpfs 799M 1,3M 798M 1% /run /dev/sda2 54G 12G 39G 23% / none 4,0K 0 4,0K 0% /sys/fs/cgroup tmpfs 1,0G 183M 842M 18% /tmp none 5,0M 0 5,0M 0% /run/lock none 3,9G 1,4M 3,9G 1% /run/shm none 100M 20K 100M 1% /run/user tmpfs 1,5G 291M 1,2G 20% /home/xuser/.cache tmpfs 512M 199M 314M 39% /home/xuser/.mozilla tmpfs 5,0G 0 5,0G 0% /home/xuser/torTmp /dev/sdb1 230G 108G 111G 50% /media/xuser/9bd1fae0-bcb9-4677-9f1a-28ac7079dccc xuser@mh:~$ 

    I started the virtual machine and forgot to clear the folder

     /home/xuser/torTmp 

    and I have it designed for torrents and a virtual machine image.

     swapoff -a 

    wrote an error saying that it could not allocate memory.

    I later realized that I had to look at what was happening in my memory system. The end of the story :).