4

Ubuntu 20.04.3 LTS is using a lot of memory, (10.1GB out of 12GB of RAM). The RAM fills up over time and reaches dangerously high levels of usage, even when I am using only 2 applications.

I've tried to follow the other suggestions posted on this forum about similar issues. I've run htop and top but they don't return useful information, ie it shows Chrome and Discord using the most amount of RAM - just 2-4% each. Java, MySQL, Apache, I've read are usually the culprits of high RAM usage, but Java isn't even running, and the other listed processes are barely using 0.1% of RAM.

Another thing I've noticed is, upon closing Chrome, the memory usage instantly drops from 10.1GB to only 1.7-2GB of usage. I dont understand this because according to htop, Chrome is using only 2% or so of memory.

2-4% should not be hogging up the entire memory, so I ran free -m and found out that buff/cache and shared usage is very high - 8.8GB and 7.2GB respectively. What are these and why are they using up so much memory? The system freezes and behaves very slowly during use. CPU usage is not very high either - hitting a max of 22% occasionally.

Here are my free -m results

free -m

On opening System Monitor,

System Monitor

My htop and top results respectively,

htop

top

As mentioned before, I'm running Ubuntu 20.04.3 LTS. Kernel version is 5.11.0-41-generic

Please help. My computer is becoming increasingly difficult to use.

Devvrath
  • 301
  • @someone Well to be honest, I haven't had this problem before. I used to use 20.04 before there were some disk corruptions and I had to reinstall the operating system fresh. I've only faced this issue after the reinstall but I can't understand how because I'm using the same programs that I used before the reinstall. I don't understand how swap memory is suddenly become an issue when I never had this kind of problem before – Devvrath Dec 04 '21 at 09:56
  • Open the processes tab in system monitor, and check which process consumes the highest memory. – Archisman Panigrahi Dec 04 '21 at 10:02
  • @ArchismanPanigrahi Chrome, with about 329MB (while using 12 tabs, but I've never had this issue of high memory usage before, even while using 20 tabs) – Devvrath Dec 04 '21 at 10:03
  • ok, so IDT swap willl work – Error404 Dec 04 '21 at 10:06
  • Look at the VIRT collomn. There is a lot of cached stuff there. – mikewhatever Dec 04 '21 at 10:48
  • You will have to debug yourself: it seems that something is filling cache memory. Reboot your system, open top and set the terminal on top, then use your computer and keep an eye on what happens. That may allow you to identify when it happens. – vanadium Dec 04 '21 at 11:46
  • Alright @vanadium I will try this and get back – Devvrath Dec 05 '21 at 03:45
  • Alright, I tried @vanadium 's suggestion and I couldn't really find out much. I just saw cached memory increase drastically. Then some time later I remembered that I had installed preload, which, if I remember correctly is a daemon which determines the most used applications and then preloads them in RAM. I don't think I had preload configured properly. As a result, it appears to have cached too much. I decided to uninstall preload, and after a reboot, the issue seems to have been solved. – Devvrath Dec 06 '21 at 15:43
  • thanks for this @Devvrath. if that worked, could you explain the how to of your solution replying to you own question please? – alfx Aug 30 '23 at 09:16

1 Answers1

0

Copying @Devvrath's comment into an answer, since it is 3 years old now and has not been converted yet.

@Devvrath had installed the preload package, after uninstalling the package their issue disappeared.

preload is a daemon that monitors/analyzes the applications users run, and tries to keep data in cache to improve the startup time of these applications.

From documentation of preload (emphasis mine):

The default values for the memory usage formula result in:

max (0,−10% × model.memtotal + 100% × model.memfree) + 30% × model.memcached

which essentially means: use all free memory except for ten percent of total memory, and thirty percent of memory already used for caches. When a system is in steady state, there is little free memory available since the kernel utilizes most of the free memory for caching. During boot time on the other hand, there is little cached memory and a lot of free memory. Given this, the model.memfree and model.memcached controls enable tuning preload’s aggressiveness during boot process and steady state fairly separately.

As indicated by this answer, a potential drawback of preload is that the RAM it consumes takes away from the pool of "unused" RAM that the kernel could otherwise use for its own caching purposes. Depending on your particular situation/usage patterns (and the tuning of preload's configuration parameters), preload might help or harm performance.

effect
  • 101