I can't clean SWAP memory. It cause that my Linux lag. I try clean but I got an output: you just be superuser.
I using jupyter notebook to learning convolution neural network. At the end of each epoch my SWAP is increasing.
I can't clean SWAP memory. It cause that my Linux lag. I try clean but I got an output: you just be superuser.
I using jupyter notebook to learning convolution neural network. At the end of each epoch my SWAP is increasing.
Have you tried turning it off and on again?
As funny as it may seem. You can forcefully clear your swap by turning swap off and on again:
sudo swapoff -a
sudo swapon -a
This will mark all swap partitions as unused by swap (then re-marking them used). Note that this will force all swap memory into physical memory - meaning some bad things might happen if you don't have enough physical memory.
If you're using swap up, you might have a memory leak as someone else has suggested.
First you need to understand how swap works - when programs demand more memory than is physically available, kernel will move memory occupied by idle programs to swap to clear up memory for currently active program.
Hard to tell without more details, but it can be perfectly ok that your program needs more memory at the end of each epoch (whatever that means) and that forces kernel to use swap.
Don't bother cleaning swap. It shows swap in use even after it was used and it is not slowing down anything at that time. And when it is used, cleaning up makes no sense.
You have two options - close other programs which you don't use or install more physical memory. That will avoid using swap.
free
program, then do the same during the run, then during the peak and then after it finishes peak. Post it here and maybe we can find what is going on
Badum, have you tried doing this?
sync; echo 1 > /proc/sys/vm/drop_caches
sync; echo 2 > /proc/sys/vm/drop_caches
sync; echo 3 > /proc/sys/vm/drop_caches
You can find the explanation here. Also, I got the commands from the same website.
drop_caches is usually only useful when doing benchmarks and timing tests of file systems and block devices, or network attached storage or file systems. You shouldn’t use any drop_cache in the first place in any real production system. It is only for testing and debugging.
P.S. It did not let me comment so I wrote it here