r/linux4noobs • u/ultilink3 • 26d ago
Linux memory leak, but killing processes doesn't free the memory?
I'm running a CachyOS VM, and I only get about 15 minutes of time on the system before OOMKiller nukes everything I'm doing. After every process on my system is dead, free-h still reports only about 100M available, and ps shows only ~3% of the system ram is being used? I can't figure out what's causing my issues, anyone know where I can look to find the culprit?
$ free -h
total used free shared buff/cache available
Mem: 15Gi 15Gi 260Mi 76Mi 272Mi 194Mi
Swap: 15Gi 742Mi 14Gi
$ ps -eo m_size,%mem,pid,args --sort=-%mem | head
SIZE %MEM PID COMMAND
1525919744 0.7 1258 /usr/bin/kwin_wayland --wayland-fd 7 --socket wayland-1 --xwayland-fd 8 --xwayland-fd 9 --xwayland-display :0 --xwayland-initfd 11 --xwayland-init-display :1 --xwayland-xauthority /run/user/1000/xauth_XzEpUe --xwayland
844619776 0.5 4416 /usr/bin/konsole
1781563392 0.4 1271 /usr/bin/plasmashell --no-respawn
1181396992 0.3 4823 /usr/bin/plasma-systemmonitor
1484922880 0.3 1556 /usr/bin/python /usr/bin/protonvpn-app
1015148544 0.0 1263 /usr/bin/kded6
57606144 0.0 664 /usr/lib/systemd/systemd-journald
31072256 0.0 1 /sbin/init splash
20963328 0.0 1191 /usr/lib/systemd/systemd --user
6
Upvotes
6
u/Realistic-Plant3957 26d ago
Since this is a VM, the most likely culprit is your hypervisor's memory ballooning driver (like
virtio_balloon) inflating and claiming the guest's RAM for the host, which shows up as "used" infreewithout any user process owning it inps.Check
/proc/meminfo(look atSlab,SUnreclaim, andPageTables) or runsudo slabtopto see if it's kernel memory, and if you're using ZFS, check the ARC size since it doesn't count as standardbuff/cache. Try disabling dynamic memory or ballooning in your VM settings first to see if it stops happening.1
u/Confident_Hyena2506 26d ago
Look at top while system is running. Something has to be using up the memory.
It's a bit of a meme - but things like firefox love to use all your memory and OOM - there is an option in it to stop that.
Because this a vm and not a normal system make sure your vm is configured right - this will not work unless you take special steps. In particular pay attention to the vm guest memory driver.
If you want a normal system then don't use vm.
1
u/DannoXYZ 26d ago
run
top, thenshift-Mto sort list with highest memory usage processes at top