I've switched to Ubuntu just a couple of months ago. Some days ago, I found out that the system is storing cache in memory which is occupying a lot of space and although I'm getting the benefit of cached memory, this is now making me in trouble.
As you can see in this picture, Ubuntu is taking more than 50% of my RAM. Additionally, I'm using 23.3% of 11.6 GiB which basically means that my system is occupying more than 75-80% of my memory...
Now, I've searched a lot of times how I can clear my cache and I've found that sync; echo 1 > /proc/sys/vm/drop_caches
command with sudo privileges can clear it, but this command only worked in the beginning like when I used this command and saw my cached my it was heavily decreased. But now, when I see my cached memory after running this it remains same.
Can anyone help me out with this trouble?
P.S. I think if I try upgrading my RAM, that won't resolve this issue...
malloc()
(memory allocation) calls and no free RAM is available then the cached ram is allocated, that part of the cache is just lost... I don't see how restrictions will help your issue, you're probably focused on the wrong issue.. (opinion, I don't know the code & my reading of linux kernel workings books was long ago) – guiverc Jul 01 '21 at 07:53tmpfs
will show as "cached memory". However, System Monitor will show this kind of memory as both cached and also being used (so it will be in the colored portion of the pie chart). This has bitten me before. – nulldev Jul 03 '21 at 18:09malloc()
on Linux essentially never returns NULL, so that's moot. – marcelm Jul 04 '21 at 15:50