Hacker News new | ask | show | jobs
by rubber_duck 3737 days ago
I don't run a PC with low ram nowdays and I've had the exact opposite problem - about 6 months ago after a random Fedora update I started noticing my system would start swapping after using it for a long time (6+ hours). I tried to diagnose memory usage but every tool I used didn't sum up used memory to the memory used by programs - and it wasn't reserved vs used or whatever - the system was visibly swapping on a machine with 8 GB ram and ~4GB memory used by running processes. I would just restart the machine after 8 hours but I've never had such issues with Windows (at least past XP, Win9x was basically restart after everything).
3 comments

I have also found that desktop Linux has stopped being a reasonable solution to "bloat". I don't concern myself too much with bloat, as my machines are all pretty big (8GB laptop, 16GB desktop), but even with 8GB I can occasional get myself into a swapping situation. Firefox (I use the multiprocess developer version) and Thunderbird are memory hogs with an impressive appetite, so if I also start up a large-ish editor (like Atom or VSCode) and Inkscape or a video editor, I can end up with real memory problems.

I haven't actually dug in to see where all the memory is going precisely, but my email/web workflow (Firefox+Thunderbird) has been the same for about ten years now, so it's interesting that it continues to bump up against memory limits no matter how much memory I have. But, Windows on the same system has similar memory issues when working on the same tasks; so it is not immune, but I don't think it is notably worse than Linux.

Turn off swap and clear your caches to see your true ram usage:

    swapoff -a -v
    echo 3 > /proc/sys/vm/drop_caches
I recommend `htop` to check out your memory usage after that.

You can also tweak the vm.swapiness variable to change Linux's behavior there. I personally just turn swap off on all my systems as soon as I set them up.

What happens if you turn off swap while using more virtual memory than you have RAM?
I imagine the OOM killer would take out a process. In that case, I would suggest paying for some more ram before turning off swap. Swap is death for performance! :)
But necessary.
I've had issues with my Nvidia graphics card that's about it. Thankfully my laptop has Intel Iris so I just switch to that when it happens.