As the Title says, I have 32GB of ram with 16+ shown as cached, instead of clearing the cached memory as needed, it begins to use swap in small amounts i.e. 210KB and continues to build up until the system locks and has to be forcibly restarted via holding down the power button.
UPDATE: simpler way
the easiest way to change AND keep your swappiness value after reboots is
sudo bash -c "echo 'vm.swappiness = 0' >> /etc/sysctl.conf"
sudo sysctl -p
you can replace the 0 with the value you want
Also, recommend not using Swap on SSD (Including eMMC or nVME).
iv'e read this
" Systems with little RAM
Things are different on a system where RAM is sparse and cannot be upgraded. In this case, swapping may indeed occur more often, especially when we run memory-intensive applications. In these systems, a swap partition or file on a SSD may lead to a dramatic performance improvement at the cost of a somewhat shorter SSD lifespan. This decreased lifespan may, however, still not be short enough to warrant concern. In all likelihood, the SSD may be replaced long before it would've died because several times the storage may be available at a fraction of today's prices."
and decided to use swap anyway ,but set it at 0...
think it'll be ok yes ?
yes i use a SSD
I dont have a swap with 32gb ram.
My desktop I just did default install over whole disk because it's HDD so it doesn't matter.
But I partitioned my old laptop myself. It has a flash drive but I decided to put a 4GB swap partition in since it has 4GB RAM. This was after a couple hours research (spread over the course of a few days) about how Linux treats memory, cache, swap. Basically since it's not a modern system, not using systemd, and has limited RAM I went the route of a swap partition in spite of the flash drive and I just let the kernel decide on how much swappiness it wants. It might not have been the best decision, it was just the best I could do at the time with the information I had and not wanting to wait years to install on that system.
I will say that so far my swap in and swap out has been 0, but I am mindful of the system and keep an eye on RAM and cache usage.
So I have an HDD not SDD, however, 14nd's solution has worked so far. I appreciate the replies!