Is there a way to dedicate RAM for Plasma for cases where both RAM and SWAP are full?

I’m having freezes when using my notebook connected via HDMI to a 4K TV with Firefox open and occasionally downloading while watching 720/1080p videos with Haruna.

This could be because of a memory leak in Firefox, which apparently has been a complaint for a really long time.

Operating System: CachyOS Linux
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.22.0
Qt Version: 6.10.1
Kernel Version: 6.18.3-2-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-11300H @ 3.10GHz
Memory: 9 GB of RAM (8.1 GB usable)
Graphics Processor 1: Intel® Iris® Xe Graphics
Graphics Processor 2: NVIDIA GeForce GTX 1650
Manufacturer: LENOVO
Product Name: 82MG
System Version: IdeaPad Gaming 3 15IHU6

It would be useful if there was a option to dedicate 1GB to Plasma, then I could just kill Firefox instead of forcing a reboot.

I can’t afford more RAM right now, nor stop using my favorite browser.

do you have enough swap space?

what does swapon say?

maybe you need to adjust your swappiness to say 70 or 80

NAME TYPE SIZE USED PRIO
/dev/zram0 partition 7,5G 142,3M 100

mine says

NAME           TYPE      SIZE USED PRIO
/swapfile      file      512M   0B   -2
/dev/nvme1n1p6 partition  72G   0B   -3

and my priorities are given by the kernel (negative values)

what does cat /etc/fstab | grep pri say about pri= values?

since you only have the one swap space it might not matter if it is set to 100, so that is where swappiness comes in to encourage the kernel to use it more often.

you might consider making the partition bigger to say 12GB, or making a 4GB swap file to add to your swap space menagerie

cat /etc/fstab | grep pri

Use ‘blkid’ to print the universally unique identifier for a device; this may

Would this even help against memory leaks? I still think that Plasma should have 1GB of RAM that only it could use.

I wonder if tweaking oom-killer (out-of-memory killer) settings here is what you would need.

For example, Fedora made changes a few years ago to try to address the problem you’re seeing, i.e. that memory-heavy applications don’t get shut down aggressively enough to protect the responsiveness of the desktop environment.

However, once in a heavy swap scenario, it’s relatively common the system gets stuck in it, where GUI interactivity is terrible to non-existent, and also the kernel oom-killer doesn’t trigger. From a certain point of view, this is working as intended. The kernel oom-killer is concerned about keeping the kernel running. It’s not at all concerned about user space responsiveness.

This might be a question best asked on Cachy forums, since the default settings are distro-specific.

Ironically I enabled “Systemd-oomd“ on my CachyOS, and the freeze still happened.

Maybe it filled the memory too fast that it killed the oom-killer?

I should mention also Limit Application Memory Usage with systemd - KDE Blogs

While this allows to limit resource usage, it also allows to prioritize processes/cgroup over others, for CPU, like CPUWeight.

2 Likes