1

I have 12GB RAM on my laptop and in free I see that there's 6GB in buff/cache but only 500MB available (+ 285MB free) RAM. What can I do to improve it? I already looked and tried clearing page (wrote 1 to 3 into /proc/sys/vm/drop_caches).

How can I see what's using the buff/cache? In system monitor (I'm using KDE on Manjaro) I see that 5GB of 12GB RAM is used and there's no app in particular using lot of RAM.

This also means that every few minutes (usually when coding in VSCode) the computer hangs for minute or two (but no visual process is killed) until I close an application (which takes a while since the whole DE is lagging).

I think (and hope) that the issue will be resolved by simply restarting, but I first wanted to as if there's a way to see what uses all the buffers/cache.

Dan B.
  • 11
  • I second your post, I'm also trying since 3 years to see what's inside those buff/cache and how to correctly calculate them since they're not reclaimable at all. Note that you're hitting the infamous oom (Out Of Memory) Linux bug, but also the bad Linux way of calculating real used RAM (top's wrongly so-called "available" RAM) and it's very bad habit of caching things (as cache should be 100% reclaimable while buffers may not). Look at this post's ( https://unix.stackexchange.com/a/420863/88282 ) comments for a clue, but I didn't got the promised answer I'd hope for since 3 years. – X.LINK Jan 20 '21 at 23:12
  • Also, since the "fixes" (e.g early-oom and systemd-oomd) are still not reliable because it's based on a percentage... that will in reality changes depending on the task, the trick is to always set a tty (ctrl + alt + F1, F2, etc) with top already opened in it to kill the hogging process should it be needed. That, and also always consider that if top says that if (at the very most) 75% of RAM is used or that 25% of RAM is "available", it's time to prepare for an oom situation. – X.LINK Jan 20 '21 at 23:23
  • One more thing, only "echo 3 > /proc/sys/vm/drop_caches " is needed since "echo 1" and "echo 2" are also included in "echo 3". ( https://www.thegeekdiary.com/how-to-clear-the-buffer-pagecache-disk-cache-under-linux/ ) – X.LINK Jan 20 '21 at 23:27
  • The OOM even prevented me from switching to a different tty so I just had to wait. I know about the echo, I just first tried 1, then 2 and then 3. I restarted the system but because it was the first restart after I set up nvidia drivers, I somehow messed up so I just reinstalled the whole system (I didn't have many apps, most of them are installed back already and the home folder was on different partition). – Dan B. Jan 21 '21 at 09:39
  • Having a pre-set tty with top might be slow to reach in case of OOM, but it's never more than 10 minutes in the worst case. You'll usually hit that in less than a minute when OOM-ing. Also, note that VSCode is an Electron app, which means that for a simple IDE (without its plugins), you'll load a whole browser engine and the JavaScripts that makes the GUI, plus your own work. Compared to a native app, you'll use and hogs far more RAM since web techs really likes to cache things in order to compensate its real slowness (also JIT-ing, etc) thus faking "responsiveness", that and CPU too. – X.LINK Jan 22 '21 at 00:03
  • Maybe another clue: https://unix.stackexchange.com/questions/440558/30-of-ram-is-buffers-what-is-it – X.LINK Jan 22 '21 at 00:14

0 Answers0