One thing I fight with on Linux is RAM and SWAP that is being used in 10ths of GBs, yet tools like htop don't show any processes using that much memory (even when run as super user). I know that disk reads are cached, this is not the problem here though. What is eating up my RAM? Why I cannot identify processes that allocated this memory? How can I reclaim it without rebooting my system?
#Linux #FOSS #htop #Manjaro #sysadmin
@unfa there is a thing called swappiness that swaps things to disk that Linux think are not needed in active memory.
@unfa Pressing H in htop should group all threads together, may make it easier to view more processes per screen and find something. All I can say at the moment...
@unfa The RES(ident) column would probably be what to look at to identify memory usage by process. So if you group the threads like has been suggested and then sort by RES then probably something would stick out.
@unfa not a bug, but a feature! processes that were open but closed now stay in memory, if you're not utilizing it for anything else
@gangrenouspenis Hmm. Why do some processes I kill free up memory instantly and some(times they) don't?
@unfa Also, I see so many lines of 1% mem usage that I wonder if they together maybe add up to the total you are seeing there
I use free - m command to see if current ram usage is less than available space. If this is true you can release swap without rebooting with swapoff command https://unix.stackexchange.com/questions/45441/what-command-can-be-used-to-force-release-everything-in-swap-partition-back-to-m
did you look at how to set the swapiness parameter ?
With something like :
sudo sysctl vm.swappiness=10
@jujudusud Oh sure - Hmm. It's set to 60. I think I've been changing that to 10 some time ago, but if memory pages are freed then this shouldn't have any effect. Seems like they are not freed however.
@unfa I have the same problem, I have browser and couple of terminal emulators opened and the RAM usage is about 11 GB out of my 16 GB's. I've used a C program to allocate memory and it went to 5 GB allocated before it was killed, after that still 10.5 GB used so it's not a disk cache problem? I'm using Manjaro KDE. (I also noticed that after I wake up my PC from sleep the ram usage grows by ~3 GB and it doesn't get freed no matter what I do) The htop also doesn't show anything suspicious.
I always think that linux never unallocate ram as long as it's not needed.
So i end up monitoring swapin/swapoff (the amount of memory going to/from swap) to monitor memory issues.
The command free can show you what is in the cache, memory used as cache (data) can be reused for anything once you stop working on it.
Let's say you open a doc, it goes on ram and will stay in cache data even when you close it. It will be delete if needed
Example (I have 16GB of ram):
I have 10GB ram used (htop) and 7.1GB is in buff/cache (free -h).
Then I run a VM in Virtualbox. The system get's very unresponsive (about 99.5% ram usage). When I kill the VM, buff/cache is still ~7GB. Can you explain that?
I noticed that this issue (at least partially) occurs when I wake up my PC from sleep. https://forum.manjaro.org/t/accumulating-lots-of-not-easily-reclaimable-shared-and-buff-cache-after-waking-up-from-sleep/64150
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!