Plasmashell memory leak caused by VirtualBox

When I run a Windows 10 guest in Virtualbox, on my Manjaro host, and I use MS Word in the guest, the memory usage of plasmashell on the host continually climbs, eating up more and more gigabytes. I worked for half an hour this morning on a Word doc, and plasmashell is already at more than 2 GB RAM usage.
To test this, I left the Win10 guest running overnight, and RAM usage on the host did not climb. So it seems to be caused by user activity in the guest machine.
The only plasma widget I am using is screen-locking button on the panel.
My Global Theme is Breeze Dark.


inxi -F                             ✔ 
System:
 Host: shmuel-manjaro Kernel: 5.16.14-1-MANJARO
   arch: x86_64 bits: 64 Desktop: KDE Plasma
   v: 5.24.3 Distro: Manjaro Linux
Machine:
 Type: Desktop Mobo: ASUSTeK
   model: PRIME B365M-A v: Rev X.0x
   serial: <superuser required>
   UEFI: American Megatrends v: 1203
   date: 10/10/2019
CPU:
 Info: 8-core model: Intel Core i7-9700
   bits: 64 type: MCP cache: L2: 2 MiB
 Speed (MHz): avg: 2318 min/max: 800/4700
   cores: 1: 800 2: 2846 3: 3555 4: 2145 5: 1557
   6: 1793 7: 3531 8: 2318
Graphics:
 Device-1: Intel CoffeeLake-S GT2 [UHD Graphics
 630]
   driver: i915 v: kernel
 Device-2: Microdia USB Live camera type: USB
   driver: snd-usb-audio,uvcvideo
 Display: x11 server: X.Org v: 1.21.1.3
   driver: X: loaded: modesetting gpu: i915
   resolution: 1: 1920x1080~120Hz
   2: 1600x900~60Hz
 OpenGL:
   renderer: Mesa Intel UHD Graphics 630 (CFL GT2)
   v: 4.6 Mesa 21.3.7
Audio:
 Device-1: Intel 200 Series PCH HD Audio
   driver: snd_hda_intel
 Device-2: JMTek LLC. USB PnP Audio Device
   type: USB
   driver: hid-generic,snd-usb-audio,usbhid
 Device-3: Microdia USB Live camera type: USB
   driver: snd-usb-audio,uvcvideo
 Sound Server-1: ALSA v: k5.16.14-1-MANJARO
   running: yes
 Sound Server-2: PulseAudio v: 15.0
   running: yes
 Sound Server-3: PipeWire v: 0.3.48
   running: yes
Network:
 Device-1: Realtek RTL8111/8168/8411 PCI
   Express Gigabit Ethernet
   driver: r8169
 IF: enp3s0 state: up speed: 1000 Mbps
   duplex: full mac: a8:5e:45:e2:87:3c
 Device-2: Realtek 802.11ac NIC type: USB
   driver: rtl8821cu
 IF: wlp0s20f0u2u1 state: down
   mac: 46:01:44:71:23:52
Bluetooth:
 Device-1: Cambridge Silicon Radio Bluetooth
   Dongle (HCI mode)
   type: USB driver: btusb
 Report: rfkill ID: hci0 state: up
   address: see --recommends
Drives:
 Local Storage: total: 2.26 TiB
   used: 846.69 GiB (36.7%)
 ID-1: /dev/sda vendor: Kingston
   model: SA400S37480G size: 447.13 GiB
 ID-2: /dev/sdb vendor: Toshiba
   model: HDWD120 size: 1.82 TiB
Partition:
 ID-1: / size: 45.88 GiB used: 22.9 GiB (49.9%)
   fs: ext4 dev: /dev/sda6
 ID-2: /boot/efi size: 96 MiB
   used: 36.9 MiB (38.5%) fs: vfat dev: /dev/sda2
Swap:
 Alert: No swap data was found.
Sensors:
 System Temperatures: cpu: 29.8 C mobo: 27.8 C
 Fan Speeds (RPM): N/A
Info:
 Processes: 311 Uptime: 10h 19m
 Memory: 15.49 GiB used: 10.43 GiB (67.3%)
 Shell: Zsh inxi: 3.3.14

Hi @shmu26 You should consider configuring a Swap file (or partition) for your system. Follow the guide and see whether it changes the utilization of plasmashell/ RAM.

Edit: I forgot the Manjaro Wiki Link for Swap. Make the swap file big enough. There is a table in the wiki for reference.

1 Like

Gonna do that right now.

Swap doesn’t seem to affect plasmashell. After working a short time in the VM, plasmashell RAM usage is close to 2 GB already.

swapon --show                       ✔ 
NAME      TYPE SIZE USED PRIO
/swapfile file   4G   0B   -2
    ~  cat /proc/sys/vm/swappiness         ✔ 

60

You generally have enough RAM so it might not need to utilize Swap. Used still say 0B.
How much RAM did you allocate to the VM? 6 or 8GB?
In Systemmonitor or KSysGuard you can drill down on plasmashell’s single processes with icon ‘Display as tree’ or ‘All processes, Tree’. Which one has highest utilization?

I allocate 4 GB to the VM.
Here is system monitor with tree

You have quite a high memory usage starting from sddm. Mine is much lower even with using VB.
More information is needed. Is it a new issue for you and when did the issue emerge? With system update? If so, can you roll back with timeshift?

Try clearing user cache just in case and check logs, Xorg, journalctl. It’s hard to pin the issue on this one. Maybe someone else from the community knows more than me.

1 Like

This is not a new issue at all. I think it is at least a year old, and I have reininstalled Manjaro without seeing any difference.
I have this issue only slightly or not at all on Kubuntu and MX KDE (yes, I am a bit of a distro hopper). As far as I can tell, it’s the same for me on all Arch-based distros. It might be an issue with the newer versions of Plasma.

I can’t confirm that. It’s running fine on my machine and no issue with plasmashell or VB on X11.

In KSysGuard with right click on columns you can add 'Show Column X11 Memory". If there is high memory consumption from X11 you may follow some checks done in this forum thread to drill down further and find the cause.

After all it could also be related to you hardware or it’s config since you said it’s the same for you on all Arch-based distros.

1 Like

Thanks for the ideas. I checked out that forum thread and it sounds like the same issue and the same hardware as me: intel cpu with integrated graphics. I also use the same workaround as they do, which to kill and restart plasmashell every once in a while.