Something is eating up RAM and I'm getting stutters because of it

Hi, so I have a weird issue. I know that RAM works a little bit differently on Linux, if I understand correctly, but the issue I’m having is that I can’t figure out why is it using up almost all of my 16GB of RAM.


Ryzen 7 5800H
2x8GB DDR4 3200MHz
nvidia-dkms 545.26.06-4
Plasma 6.0.2
Dual NVMe (512GB + 1TB (Linux is installed on this drive with ext4 and 16GB for swap))

Example situation:
Apps running: Firefox, Discord, VSCode
VSCode has these extensions: C/C++, poimandres (theme for VSCode), indent rainbow, Java Support, TestMyCode
Tabs running on Firefox: About 5-8.

At first, I would have like 8-9GB of RAM usage, no problem, no stutters, usable. But it gradually increases to like 13-14GB of usage and that’s when stutters start.

I keep btop and htop running on a second screen and I can’t really notice anything unusual about the running processes. But, in htop I can notice there are times when kswapd0 kicks in and that causes one of my cores almost to max out and that’s what causes a stutter. Even though, at that time, swap is only used like 10-30%. I don’t know where to really look for the issue or what’s causing it.

Thanks in advance!

Any reason why your packages seem outdated?
Have you used the IgnorePkg feature in /etc/pacman.conf?

NVIDIA’s driver and Linux kernel are downgraded because of this - I had the same issue and the easiest way for me to solve it was to downgrade the kernel to 6.7.9 and NVIDIA driver to 545. As far as I know, 545 driver isn’t supported on 6.8 kernel, so that’s why.

Other packages were updated recently, so it’s only the kernel and NVIDIA driver that are outdated.

Just out of curiosity, what kind of swap device are you using: swapfile, swap partition, zram?

What is the swappiness?

sysctl vm.swappiness

It’s a swap partition, created by the EndeavourOS installer. I haven’t really configured anything else myself.

[righn@righn-omen ~]$ sysctl vm.swappiness
vm.swappiness = 60
1 Like

Here the latest nvidia and linux work OK on my desktop.
Downgrading essential packages may cause weird problems, and causes partial update situation.
So you could try now if the latest stuff works. Be sure to have the USB livesystem available.

I would upgrade, but as I said, the issue, that I posted, also affects me (had to try to recover the system one time, because of it. There was a second time it happened and I couldn’t recover the system after that, had to reinstall). It only seems to affect laptop users, which I am. I was on 550 driver and 6.8 kernel before and I had the same issue with RAM to be honest.

Btw, have you tried the lts kernel?

I have not, I’ll try it then.

Not saying that this would resolve the issue but I would give zram a try.
It won’t do any harm testing it.

If you want, I suggest you to consider zram-generator.

Have a look at:


Keep an eye on the memory and swap consumption:

watch free -m

I was thinking about it, but still decided against it until I did more research. Especially if zram is usable for hibernation. Or should I still keep my swap partition for it, that’s what I don’t really understand.

Zram cannot be used for hibernation (aka suspend-to-disk).
You can keep your current swap partition as well.

I have both zram and a swapfile (for hibernation).
They will have different swap priority. Zram will have a much higher priority than the swap file/partition and therefore will be used first.

So update!

I got zram set up and installed LTS kernel. Just as an experiment, tried to switch to InteliJ IDEA, as at the moment I’m mostly working with Java and did the issue go away?

Not completely. It’s not as frequent, but still not great. Either I’m overestimating how much 16GB of RAM can handle or the issue goes deeper.

If any of you are wondering, I did run a memtest86+ just to be sure there are no issues with my RAM sticks for like 8 hours, no errors were returned.

zram is not suitable for hibernation. fedora is using zram and they have work arounds available for hibernation. The use a couple of extra systemd services to enable a swalfile/swap partition before hibernating and on resume they disable them and enable zram again.

I see that this methods uses BTRFS, but I’m using ext4, so this doesn’t apply to me or is the process the same?

The services are the same. I used it with XFS. You just need to adapt the piece where you calculate the offset of the swapfile.

And it works well. I used fedora on my laptop with hibernation for quite a while.

Is enabling/disabling swapfil resp. zram really necessary for hibernation/resuming to work?

I do use both zram and a swapfile, the latter for hibernation, and so far I have been able to hibernate this system and resume from hibernation without any issues.

I dont know. I did not investigate this. I followed the instructions for fedora and they work.

1 Like

I haven’t really done anything to configure to actually, just followed the instructions you gave me from Arch wiki for zram. Hibernation worked perfectly since.

1 Like